changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > core / lisp/lib/organ/tests.lisp

changeset 698: 96958d3eb5b0
parent: 7ca4cdbd52c2
author: Richard Westhaver <ellis@rwest.io>
date: Fri, 04 Oct 2024 22:04:59 -0400
permissions: -rw-r--r--
description: fixes
1 (defpackage :organ/tests
2  (:use :cl :organ :std :rt)
3  (:export *test-org-file*))
4 
5 (in-package :organ/tests)
6 (in-readtable :std)
7 (defparameter *test-org-heading*
8  #"* TODO [#A] header1 :tag1:tag2:
9 :PROPERTIES:
10 :ID: 1234
11 :CUSTOM_ID: 5678
12 :END:
13 "#)
14 
15 (defparameter *test-org-section*
16  "Paragraph with /italics/ *bold* =verbatim= ~code~ _underline_ +strike-through+.
17 
18 #+begin_src lisp
19 (print \"hello world\")
20 #+end_src")
21 
22 (defparameter *test-org-lines*
23  "Plain text.
24 /Italics/
25 *bold*
26 =verbatim=
27 ~code~
28 _underline_
29 +strike-through+")
30 
31 (defsuite :organ)
32 (in-suite :organ)
33 
34 ;;; Objects
35 (deftest org-markup ()
36  "Test org markup in a paragraph."
37  (let ((lines (read-org-lines-from-string *test-org-lines*)))
38  (is (org-parse :plain-text (aref lines 0)))
39  (is (org-parse :italic (aref lines 1)))
40  (is (org-parse :bold (aref lines 2)))
41  (is (org-parse :verbatim (aref lines 3)))
42  (is (org-parse :code (aref lines 4)))
43  (is (org-parse :underline (aref lines 5)))
44  (is (org-parse :strike-through (aref lines 6))))
45  ;; should return vector of ORG-OBJECTs
46  (is (typep (org-contents (org-parse :paragraph *test-org-lines*)) 'vector)))
47 
48 (deftest org-minimal ())
49 
50 (deftest org-standard ())
51 
52 (defun headline-ok (hl)
53  (and
54  (> (organ::hl-stars hl) 0)
55  (organ::hl-kw hl)
56  (organ::hl-priority hl)
57  (organ::hl-title hl)
58  (> (length (organ::hl-tags hl)) 0)))
59 
60 ;;; Elements
61 (deftest org-headline () (is (headline-ok (org-parse :headline "** DONE [#A] testing stuff :foo:bar:"))))
62 
63 ;;; API
64 (deftest org-heading ()
65  (is (headline-ok (org-headline (org-parse :heading *test-org-heading*)))))
66 
67 (deftest org-section ())
68 
69 (deftest org-document ())
70 
71 (deftest org-lines ()
72  (is (vectorp (read-org-lines-from-string *test-org-heading*))))