Coverage report: /home/ellis/comp/core/lib/organ/tests.lisp

KindCoveredAll%
expression1835 51.4
branch36 50.0
Key
Not instrumented
Conditionalized out
Executed
Not executed
 
Both branches taken
One branch taken
Neither branch taken
1
 (defpackage :organ/tests
2
   (:use :cl :organ :std :rt :rt/fuzz)
3
   (:export *test-org-file*))
4
 
5
 (in-package :organ/tests)
6
 (in-readtable :std)
7
 
8
 (defclass org-fuzzer (fuzzer) ()
9
   (:default-initargs
10
    :state nil
11
    :generator 
12
    (lambda (state)
13
      (org-create 
14
       (or state
15
           (keywordicate
16
            (random-elt (append org-element-objects org-element-types))))))))
17
 
18
 (defparameter *test-org-heading* 
19
   #"* TODO [#A] header1                       :tag1:tag2:
20
 :PROPERTIES:
21
 :ID: 1234
22
 :CUSTOM_ID: 5678
23
 :END:
24
 "#)
25
 
26
 (defparameter *test-org-section*
27
   "Paragraph with /italics/ *bold* =verbatim= ~code~ _underline_ +strike-through+.
28
 
29
 #+begin_src lisp
30
 (print \"hello world\")
31
 #+end_src")
32
 
33
 (defparameter *test-org-lines*
34
   "Plain text.
35
 /Italics/
36
 *bold*
37
 =verbatim=
38
 ~code~
39
 _underline_
40
 +strike-through+")
41
 
42
 (defsuite :organ)
43
 (in-suite :organ)
44
 
45
 ;;; Objects
46
 (deftest org-markup ()
47
   "Test org markup in a paragraph."
48
   (let ((lines (read-org-lines-from-string *test-org-lines*)))
49
     (is (org-parse :plain-text (aref lines 0)))
50
     (is (org-parse :italic (aref lines 1)))
51
     (is (org-parse :bold (aref lines 2)))
52
     (is (org-parse :verbatim (aref lines 3)))
53
     (is (org-parse :code (aref lines 4)))
54
     (is (org-parse :underline (aref lines 5)))
55
     (is (org-parse :strike-through (aref lines 6))))
56
   ;; should return vector of ORG-OBJECTs
57
   (is (typep (org-contents (org-parse :paragraph *test-org-lines*)) 'vector)))
58
 
59
 (deftest org-minimal ())
60
 
61
 (deftest org-standard ())
62
 
63
 (defun headline-ok (hl)
64
   (is
65
    (and
66
     (> (organ::hl-stars hl) 0)
67
     (organ::hl-kw hl)
68
     (organ::hl-priority hl)
69
     (organ::hl-title hl)
70
     (> (length (organ::hl-tags hl)) 0))))
71
 
72
 ;;; Elements
73
 (deftest org-headline () (is (headline-ok (org-parse :headline "** DONE [#A] testing stuff :foo:bar:"))))
74
 
75
 ;;; API
76
 (deftest org-heading ()
77
   (is (headline-ok (org-headline (org-parse :heading *test-org-heading*)))))
78
 
79
 (deftest org-section ())
80
 
81
 (deftest org-document ())
82
 
83
 (deftest org-lines ()
84
   (is (vectorp (read-org-lines-from-string *test-org-heading*))))