Skip to content

Commit 411eb48

Browse files
Sensorflo/pr35 (#3)
* edit to remove some of the warnings from flycheck * Re-formulate first comment line of adoctest-trans. Additionally delete some trailing spaces. Co-authored-by: phelanm <phelanm@gmail.com> Co-authored-by: Tobias Zawada <TOZ@esi-group.com>
1 parent c117d58 commit 411eb48

2 files changed

Lines changed: 60 additions & 47 deletions

File tree

Cask

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
(source marmalade)
2+
3+
(package "adoc-mode" "0.6.2" "a major-mode for editing AsciiDoc files in Emacs")
4+
5+
(development
6+
(depends-on "adoc-mode")
7+
)

adoc-mode-test.el

Lines changed: 53 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
;;; adoc-mode-test.el --- test suite for adoc-mode.el
2-
;;;
2+
;;;
33
;;; Commentary:
4-
;;
4+
;;
55
;; Call adoc-test-run to run the test suite
6-
;;
6+
;;
77
;;; Todo:
8-
;; - test for font lock multiline property
8+
;; - test for font lock multiline property
99
;; - test for presence of adoc-reserved (we do white-box testing here)
1010
;; - test also with multiple versions of (X)Emacs
1111
;; - compare adoc-mode fontification with actuall output from AsciiDoc, being
@@ -22,6 +22,7 @@
2222
;; - beginning/end of paragraph
2323
;; - side-to-side yes/no with next same construct
2424
(defun adoctest-faces (name &rest args)
25+
"Todo document adoctest-faces NAME ARGS."
2526
(let ((not-done t)
2627
(font-lock-support-mode))
2728
(with-temp-buffer
@@ -52,13 +53,13 @@
5253
(setq not-done nil)))))))
5354

5455
(defun adoctest-trans (original-text expected-text transform)
55-
"Calling TRANSFORM on EXPECTED-TEXT, ORIGINAL-TEXT `should' result.
56+
"Calling TRANSFORM on ORIGINAL-TEXT `should' result in EXPECTED-TEXT.
5657
ORIGINAL-TEXT is put in an temporary buffer and TRANSFORM is
57-
evaluated using `eval'. The resulting buffer content is compared
58+
evaluated using `eval'. The resulting buffer content is compared
5859
to EXPECTED-TEXT.
5960
6061
ORIGINAL-TEXT optionaly may contain the following special
61-
charachters. Escaping them is not (yet) supported. They are
62+
charachters. Escaping them is not (yet) supported. They are
6263
removed before TRANSFORM is evaluated.
6364
6465
! Position of point before TRANSFORM is evaluated
@@ -86,14 +87,15 @@ removed before TRANSFORM is evaluated.
8687
(setq pos (1+ pos))
8788
(setq pos-old pos))
8889
(setq new-original-text (concat new-original-text (substring original-text pos-old pos)))
89-
;; run adoctest-trans-inner for each remembered pos
90+
;; run adoctest-trans-inner for each remembered pos
9091
(while pos-new-list
9192
(adoctest-trans-inner new-original-text expected-text transform (car pos-new-list))
9293
(setq pos-new-list (cdr pos-new-list))))
9394
;; original-text has no ! markers
9495
(adoctest-trans-inner original-text expected-text transform)))
9596

9697
(defun adoctest-trans-inner (original-text expected-text transform &optional pos)
98+
"Todo document adoctest-trans-inner ORIGINAL-TEXT EXPECTED-TEXT TRANSFORM POS."
9799
(let ((not-done t)
98100
(font-lock-support-mode))
99101
(with-temp-buffer
@@ -105,7 +107,7 @@ removed before TRANSFORM is evaluated.
105107
(goto-char (1+ (car pos)))
106108
(set-mark (1+ (cdr pos))))
107109
(pos
108-
(goto-char (1+ pos))))
110+
(goto-char (1+ pos))))
109111
;; exercise
110112
(eval transform)
111113
;; verify
@@ -240,7 +242,7 @@ removed before TRANSFORM is evaluated.
240242

241243
(ert-deftest adoctest-test-comments ()
242244
(adoctest-faces "comments"
243-
;; as block macro
245+
;; as block macro
244246
"// lorem ipsum\n" markup-comment-face
245247
"\n" nil
246248
;; as inline macro
@@ -364,19 +366,19 @@ removed before TRANSFORM is evaluated.
364366
(adoctest-faces "images"
365367
;; block macros
366368
;; empty arglist
367-
"image" markup-complex-replacement-face "::" markup-meta-face
369+
"image" markup-complex-replacement-face "::" markup-meta-face
368370
"./foo/bar.png" markup-internal-reference-face
369371
"[]" markup-meta-face "\n" nil
370-
;; pos attribute 0 = alternate text
371-
"image" markup-complex-replacement-face "::" markup-meta-face
372+
;; pos attribute 0 = alternate text
373+
"image" markup-complex-replacement-face "::" markup-meta-face
372374
"./foo/bar.png" markup-internal-reference-face
373375
"[" markup-meta-face "lorem ipsum" markup-secondary-text-face "]" markup-meta-face "\n" nil
374376
;; keyword title
375-
"image" markup-complex-replacement-face "::" markup-meta-face
377+
"image" markup-complex-replacement-face "::" markup-meta-face
376378
"./foo/bar.png" markup-internal-reference-face
377379
"[" markup-meta-face "alt" markup-attribute-face "=" markup-meta-face "lorem ipsum" markup-secondary-text-face "]" markup-meta-face "\n" nil
378380
;; keyword alt and title
379-
"image" markup-complex-replacement-face "::" markup-meta-face
381+
"image" markup-complex-replacement-face "::" markup-meta-face
380382
"./foo/bar.png" markup-internal-reference-face
381383
"[" markup-meta-face "alt" markup-attribute-face "=" markup-meta-face "lorem ipsum" markup-secondary-text-face "," markup-meta-face
382384
"title" markup-attribute-face "=" markup-meta-face "lorem ipsum" markup-secondary-text-face "]" markup-meta-face "\n" nil
@@ -389,19 +391,19 @@ removed before TRANSFORM is evaluated.
389391
"lorem\nipsum\nsit" markup-secondary-text-face "]" markup-meta-face "\n" nil
390392

391393
;; no everything again with inline macros
392-
"foo " 'no-face "image" markup-complex-replacement-face ":" markup-meta-face
394+
"foo " 'no-face "image" markup-complex-replacement-face ":" markup-meta-face
393395
"./foo/bar.png" markup-internal-reference-face
394396
"[]" markup-meta-face "bar" 'no-face "\n" nil
395397

396-
"foo " 'no-face "image" markup-complex-replacement-face ":" markup-meta-face
398+
"foo " 'no-face "image" markup-complex-replacement-face ":" markup-meta-face
397399
"./foo/bar.png" markup-internal-reference-face
398400
"[" markup-meta-face "lorem ipsum" markup-secondary-text-face "]" markup-meta-face "bar" 'no-face "\n" nil
399401

400-
"foo " 'no-face "image" markup-complex-replacement-face ":" markup-meta-face
402+
"foo " 'no-face "image" markup-complex-replacement-face ":" markup-meta-face
401403
"./foo/bar.png" markup-internal-reference-face
402404
"[" markup-meta-face "alt" markup-attribute-face "=" markup-meta-face "lorem ipsum" markup-secondary-text-face "]" markup-meta-face "bar" 'no-face "\n" nil
403405

404-
"foo " 'no-face "image" markup-complex-replacement-face ":" markup-meta-face
406+
"foo " 'no-face "image" markup-complex-replacement-face ":" markup-meta-face
405407
"./foo/bar.png" markup-internal-reference-face
406408
"[" markup-meta-face "alt" markup-attribute-face "=" markup-meta-face "lorem ipsum" markup-secondary-text-face "," markup-meta-face
407409
"title" markup-attribute-face "=" markup-meta-face "lorem ipsum" markup-secondary-text-face "]" markup-meta-face "bar" 'no-face "\n" nil
@@ -415,15 +417,15 @@ removed before TRANSFORM is evaluated.
415417

416418
(ert-deftest adoctest-test-attribute-list ()
417419
(adoctest-faces "attribute-list"
418-
;; positional attribute
419-
"[" markup-meta-face "hello" markup-value-face "]" markup-meta-face "\n" nil
420+
;; positional attribute
421+
"[" markup-meta-face "hello" markup-value-face "]" markup-meta-face "\n" nil
420422
;; positional attribute containing spaces
421-
"[" markup-meta-face "hello world" markup-value-face "]" markup-meta-face "\n" nil
423+
"[" markup-meta-face "hello world" markup-value-face "]" markup-meta-face "\n" nil
422424
;; positional attribute as string
423-
"[\"" markup-meta-face "hello world" markup-value-face "\"]" markup-meta-face "\n" nil
425+
"[\"" markup-meta-face "hello world" markup-value-face "\"]" markup-meta-face "\n" nil
424426

425427
;; multiple positional attributes
426-
"[" markup-meta-face "hello" markup-value-face "," markup-meta-face "world" markup-value-face "]" markup-meta-face "\n" nil
428+
"[" markup-meta-face "hello" markup-value-face "," markup-meta-face "world" markup-value-face "]" markup-meta-face "\n" nil
427429

428430
;; multiple positional attributes, however one or both are empty (really empty or only one space)
429431
"[" markup-meta-face "hello" markup-value-face ",]" markup-meta-face "\n" nil
@@ -440,19 +442,19 @@ removed before TRANSFORM is evaluated.
440442
"[" markup-meta-face " " markup-value-face "]" markup-meta-face "\n" nil
441443

442444
;; keyword attribute
443-
"[" markup-meta-face "salute" markup-attribute-face "=" markup-meta-face "hello" markup-value-face "]" markup-meta-face "\n" nil
445+
"[" markup-meta-face "salute" markup-attribute-face "=" markup-meta-face "hello" markup-value-face "]" markup-meta-face "\n" nil
444446
;; keyword attribute where value is a string
445-
"[" markup-meta-face "salute" markup-attribute-face "=\"" markup-meta-face "hello world" markup-value-face "\"]" markup-meta-face "\n" nil
447+
"[" markup-meta-face "salute" markup-attribute-face "=\"" markup-meta-face "hello world" markup-value-face "\"]" markup-meta-face "\n" nil
446448

447449
;; multiple positional attributes, multiple keyword attributes
448450
"[" markup-meta-face "lorem" markup-value-face "," markup-meta-face "ipsum" markup-value-face "," markup-meta-face
449451
"dolor" markup-attribute-face "=" markup-meta-face "sit" markup-value-face "," markup-meta-face
450-
"dolor" markup-attribute-face "=" markup-meta-face "sit" markup-value-face "]" markup-meta-face "\n" nil
452+
"dolor" markup-attribute-face "=" markup-meta-face "sit" markup-value-face "]" markup-meta-face "\n" nil
451453

452454
;; is , within strings really part of the string and not mistaken as element separator
453-
"[\"" markup-meta-face "lorem,ipsum=dolor" markup-value-face "\"]" markup-meta-face "\n" nil
455+
"[\"" markup-meta-face "lorem,ipsum=dolor" markup-value-face "\"]" markup-meta-face "\n" nil
454456
;; does escaping " in strings work
455-
"[\"" markup-meta-face "lorem \\\"ipsum\\\" dolor" markup-value-face "\"]" markup-meta-face
457+
"[\"" markup-meta-face "lorem \\\"ipsum\\\" dolor" markup-value-face "\"]" markup-meta-face
456458
))
457459

458460
(ert-deftest adoctest-test-block-macro ()
@@ -593,7 +595,7 @@ removed before TRANSFORM is evaluated.
593595
;; 1) test that meta characters always only have a single meta and don't get
594596
;; markup-bold/-emphasis/... face just because they are within a
595597
;; strongh/emphasis/... construct.
596-
;; 2) test that nested quotes really apply the faces of both quotes to the inner text
598+
;; 2) test that nested quotes really apply the faces of both quotes to the inner text
597599
(adoctest-faces "meta-face-cleanup-1"
598600
"*" markup-meta-hide-face "lorem " markup-strong-face
599601
"_" markup-meta-hide-face "ipsum" '(markup-strong-face markup-emphasis-face) "_" markup-meta-hide-face
@@ -611,7 +613,7 @@ removed before TRANSFORM is evaluated.
611613

612614
(ert-deftest adoctest-test-url ()
613615
(adoctest-faces "url"
614-
;; url inline macro with attriblist
616+
;; url inline macro with attriblist
615617
"foo " nil
616618
"http://www.lorem.com/ipsum.html" markup-internal-reference-face
617619
"[" markup-meta-face "sit amet" markup-reference-face "]" markup-meta-face
@@ -622,7 +624,7 @@ removed before TRANSFORM is evaluated.
622624
"sit,\namet,\nconsectetur" markup-reference-face
623625
"]" markup-meta-face
624626
" bar \n" nil
625-
;; url inline macro withOUT attriblist
627+
;; url inline macro withOUT attriblist
626628
"http://www.lorem.com/ipsum.html" markup-reference-face
627629
"[]" markup-meta-face
628630
" bar \n" nil
@@ -632,7 +634,7 @@ removed before TRANSFORM is evaluated.
632634

633635
(ert-deftest adoctest-test-url-enclosing-quote ()
634636
(adoctest-faces "url-enclosing-quote"
635-
;; spaces between __ and url seem really to be needed also in asciidoc
637+
;; spaces between __ and url seem really to be needed also in asciidoc
636638
"foo " nil "__" markup-meta-hide-face " " nil
637639
"http://www.lorem.com/ipsum.html" '(markup-emphasis-face markup-reference-face)
638640
" " nil "__" markup-meta-hide-face
@@ -647,9 +649,9 @@ removed before TRANSFORM is evaluated.
647649
(ert-deftest adoctest-test-inline-subst-boundaries ()
648650
(adoctest-faces "inline-subst-boundaries"
649651

650-
;; 1) don't cross title boundaries.
652+
;; 1) don't cross title boundaries.
651653
;; 2) don't cross paragraph boundaries.
652-
;; 3) verify that the (un)constrained quotes would work however
654+
;; 3) verify that the (un)constrained quotes would work however
653655
"== " markup-meta-hide-face "chapter ** 1" markup-title-1-face "\n" nil
654656
"lorem ** ipsum\n" 'no-face
655657
"\n" nil
@@ -686,7 +688,7 @@ removed before TRANSFORM is evaluated.
686688
"-" markup-list-face " " nil "dolor ** sit\n" 'no-face
687689
;; test that a quote within the list element works
688690
"-" markup-list-face " " nil "dolor " 'no-face "**" markup-meta-hide-face " sit " markup-strong-face "**" markup-meta-hide-face "\n" nil
689-
;; dont mistake '**' list elements for quote starters/enders
691+
;; dont mistake '**' list elements for quote starters/enders
690692
"**" markup-list-face " " nil "lorem ** ipsum\n" 'no-face
691693
"**" markup-list-face " " nil "dolor ** sit\n" 'no-face
692694
"**" markup-list-face " " nil "dolor ** sit\n" 'no-face
@@ -731,7 +733,7 @@ removed before TRANSFORM is evaluated.
731733
(ert-deftest adoctest-test-xref-at-point-1 ()
732734
(unwind-protect
733735
(progn
734-
(set-buffer (get-buffer-create "adoc-test"))
736+
(set-buffer (get-buffer-create "adoc-test"))
735737
(insert "lorem xref:bogous1[] ipsum xref:foo[bla\nbli] dolor xref:bogous2[]")
736738
(re-search-backward "bli") ; move point within ref
737739
(should (equal (adoc-xref-id-at-point) "foo")))
@@ -740,7 +742,7 @@ removed before TRANSFORM is evaluated.
740742
(ert-deftest adoctest-test-xref-at-point-2 ()
741743
(unwind-protect
742744
(progn
743-
(set-buffer (get-buffer-create "adoc-test"))
745+
(set-buffer (get-buffer-create "adoc-test"))
744746
(insert "lorem <<bogous1,caption>> ipsum <<foo,bla\nbli>> dolor <<bogous2>>")
745747
(re-search-backward "bli") ; move point within ref
746748
(should (equal (adoc-xref-id-at-point) "foo")))
@@ -749,7 +751,7 @@ removed before TRANSFORM is evaluated.
749751
(ert-deftest adoctest-test-goto-ref-label ()
750752
(unwind-protect
751753
(progn
752-
(set-buffer (get-buffer-create "adoc-test"))
754+
(set-buffer (get-buffer-create "adoc-test"))
753755
(insert "[[foo]]\n" ;1
754756
"lorem ipsum\n" ;2
755757
"[[bar]]\n" ;3
@@ -764,18 +766,20 @@ removed before TRANSFORM is evaluated.
764766
(kill-buffer "adoc-test")))
765767

766768
(defun adoctest-template (template expected)
769+
"Todo document adoctest-template TEMPLATE EXPECTED."
767770
(let ((buf-name (concat "adoctest-" (symbol-name template))))
768771
(unwind-protect
769772
(progn
770773
;; setup
771-
(set-buffer (get-buffer-create buf-name))
774+
(set-buffer (get-buffer-create buf-name))
772775
(delete-region (point-min) (point-max))
773776
(funcall template)
774777
(should (equal (buffer-substring-no-properties (point-min) (point-max)) expected)))
775778
;; tear-down
776779
(kill-buffer buf-name))))
777780

778781
(defun adoctest-quotes (start-del end-del transform)
782+
"Todo document adoctest-quotes START-DEL END-DEL TRANSFORM."
779783
(adoctest-trans "lorem ! ipsum"
780784
(concat "lorem " start-del end-del " ipsum") transform)
781785
(adoctest-trans "lorem <ipsum> dolor"
@@ -840,6 +844,7 @@ removed before TRANSFORM is evaluated.
840844
(adoctest-trans "lorem<ipsum>" "lorem\nTIP: ipsum" '(tempo-template-adoc-paragraph-tip)))
841845

842846
(defun adoctest-delimited-block (del transform)
847+
"Todo document adoctest-delimited-block DEL TRANSFORM."
843848
(let ((del-line (if (integerp del) (make-string 50 del) del)))
844849
(adoctest-trans
845850
"" (concat del-line "\n\n" del-line) transform)
@@ -954,6 +959,7 @@ removed before TRANSFORM is evaluated.
954959
;;
955960
;; todo: also test for warnings
956961
(defun adoctest-save-compile-load ()
962+
"Todo document adoctest-save-compile-load."
957963
(unwind-protect
958964
(progn
959965
(let ((buf-adoc-mode (find-buffer-visiting "adoc-mode.el"))
@@ -963,17 +969,17 @@ removed before TRANSFORM is evaluated.
963969
(cond
964970
((null buf-adoc-mode)) ;nop
965971
((bufferp buf-adoc-mode) (save-buffer buf-adoc-mode))
966-
(t (error "Multiple buffer are visiting adoc-mode.el. Save them first")))
967-
(or (byte-compile-file (locate-library "adoc-mode.el" t)) (error "compile error"))
968-
(or (load "adoc-mode.el" nil nil t) (error "load error"))
972+
(t (error "Multiple buffer are visiting adoc-mode.el. Save them first")))
973+
(or (byte-compile-file (locate-library "adoc-mode.el" t)) (error "Compile error"))
974+
(or (load "adoc-mode.el" nil nil t) (error "Load error"))
969975

970976
;; adoc-mode-test
971977
(cond
972978
((null buf-adoc-mode-test)) ;nop
973979
((bufferp buf-adoc-mode-test) (save-buffer buf-adoc-mode-test))
974-
(t (error "Multiple buffer are visiting adoc-mode-test.el. Save them first")))
975-
(or (byte-compile-file (locate-library "adoc-mode-test.el" t)) (error "compile error"))
976-
(or (load "adoc-mode-test.el" nil nil t) (error "load error"))))
980+
(t (error "Multiple buffer are visiting adoc-mode-test.el. Save them first")))
981+
(or (byte-compile-file (locate-library "adoc-mode-test.el" t)) (error "Compile error"))
982+
(or (load "adoc-mode-test.el" nil nil t) (error "Load error"))))
977983

978984
(when (file-exists-p "adoc-mode.elc")
979985
(delete-file "adoc-mode.elc"))
@@ -985,7 +991,7 @@ removed before TRANSFORM is evaluated.
985991

986992
;; ensure that a failed test can be re-run
987993
(when (get-buffer "*ert*")
988-
(kill-buffer "*ert*"))
994+
(kill-buffer "*ert*"))
989995

990996
;; ensure no no-longer test defuns exist, which would otherwise be executed
991997
(mapatoms

0 commit comments

Comments
 (0)