2022-05-09 21:57:43 +03:00
|
|
|
:: This library contains unit tests for doccords.
|
|
|
|
::
|
|
|
|
/+ *test, *dprint
|
|
|
|
::
|
2022-05-09 23:01:32 +03:00
|
|
|
=> =>
|
|
|
|
:: This core is for testing core and chapter docs.
|
|
|
|
:> core-summary
|
|
|
|
:>
|
|
|
|
:> core-description
|
2022-06-07 19:37:32 +03:00
|
|
|
|% %core-test
|
2022-05-09 23:45:16 +03:00
|
|
|
:> chapter-summary
|
|
|
|
:>
|
|
|
|
:> chapter-description
|
|
|
|
+| %chapter-test
|
2022-05-09 23:01:32 +03:00
|
|
|
++ empty ~
|
|
|
|
--
|
|
|
|
::
|
2022-07-01 17:39:01 +03:00
|
|
|
:> arms used for testing doccords
|
2022-06-07 19:37:32 +03:00
|
|
|
|% %test-arms
|
2022-05-09 21:57:43 +03:00
|
|
|
+| %types
|
2022-07-01 20:48:48 +03:00
|
|
|
+$ arm-dox [tape what what what]
|
|
|
|
+$ core-dox [tape what]
|
2022-05-09 23:45:16 +03:00
|
|
|
+$ chapter-dox [tape what]
|
2022-05-09 21:57:43 +03:00
|
|
|
::
|
|
|
|
+| %helper-functions
|
|
|
|
++ get-item
|
|
|
|
|= a=(list term)
|
|
|
|
^- item
|
2022-07-01 00:18:09 +03:00
|
|
|
+:(find-item-in-type a -:!>(.))
|
2022-05-09 21:57:43 +03:00
|
|
|
::
|
|
|
|
++ get-arm-dox
|
|
|
|
|= a=(list term)
|
|
|
|
^- arm-dox
|
|
|
|
=/ itm=item (get-item a)
|
|
|
|
?> ?=([%arm *] itm)
|
|
|
|
[name adoc pdoc cdoc]:itm
|
|
|
|
::
|
2022-05-09 23:01:32 +03:00
|
|
|
++ get-core-dox
|
|
|
|
|= a=(list term)
|
|
|
|
^- core-dox
|
|
|
|
=/ itm=item (get-item a)
|
|
|
|
?> ?=([%core *] itm)
|
|
|
|
[name docs]:itm
|
|
|
|
::
|
2022-05-09 23:45:16 +03:00
|
|
|
++ get-chapter-dox
|
|
|
|
|= a=(list term)
|
|
|
|
^- chapter-dox
|
|
|
|
=/ itm=item (get-item a)
|
|
|
|
?> ?=([%chapter *] itm)
|
|
|
|
[name docs]:itm
|
|
|
|
::
|
2022-07-01 17:39:01 +03:00
|
|
|
++ arm-check
|
2022-07-01 20:48:48 +03:00
|
|
|
|= [arms=(list term) wat=(trel ? ? ?) docs=(trel what what what)]
|
2022-07-01 17:39:01 +03:00
|
|
|
^- tang
|
|
|
|
=| res=tang
|
|
|
|
|-
|
|
|
|
?~ arms res
|
|
|
|
%= $
|
|
|
|
arms t.arms
|
|
|
|
res %+ weld
|
|
|
|
res
|
|
|
|
%+ expect-eq
|
|
|
|
!> ^- arm-dox
|
|
|
|
:* (trip i.arms)
|
2022-07-01 20:48:48 +03:00
|
|
|
?:(p.wat p.docs *what)
|
|
|
|
?:(q.wat q.docs *what)
|
|
|
|
?:(r.wat r.docs *what)
|
2022-07-01 17:39:01 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
!> (get-arm-dox ~[i.arms])
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ run-arm-tests
|
2022-07-01 20:48:48 +03:00
|
|
|
|= [wat=(trel ? ? ?)]
|
2022-07-01 17:39:01 +03:00
|
|
|
^- tang
|
2022-07-01 20:48:48 +03:00
|
|
|
=/ num (sub 3 :(add p.wat q.wat r.wat))
|
2022-07-01 17:39:01 +03:00
|
|
|
=/ prefix=term
|
|
|
|
;: (cury cat 3)
|
|
|
|
%arm-
|
2022-07-01 20:48:48 +03:00
|
|
|
?:(p.wat %adoc- ~)
|
|
|
|
?:(q.wat %pdoc- ~)
|
|
|
|
?:(r.wat %cdoc- ~)
|
2022-07-01 17:39:01 +03:00
|
|
|
==
|
2022-07-01 20:48:48 +03:00
|
|
|
=/ arms=(list term)
|
|
|
|
%- turn
|
|
|
|
:_ |= [postfix=term]
|
|
|
|
`term`(cat 3 prefix postfix)
|
|
|
|
^- (list term)
|
2022-07-01 17:39:01 +03:00
|
|
|
?+ num ~
|
|
|
|
%1 ~[%pre %post]
|
|
|
|
%2 ~[%pre-pre %post-pre %post-post]
|
|
|
|
%3 :~ %pre-pre-pre
|
|
|
|
%pre-pre-post
|
|
|
|
%pre-post-pre
|
|
|
|
%post-pre-pre
|
|
|
|
%pre-post-post
|
|
|
|
%post-pre-post
|
|
|
|
%post-post-pre
|
2022-07-01 20:48:48 +03:00
|
|
|
==
|
|
|
|
==
|
|
|
|
%^ arm-check
|
|
|
|
arms
|
|
|
|
wat
|
|
|
|
[`['arm-doc' ~] `['product-doc' ~] `['core-doc' ~]]
|
2022-07-01 17:39:01 +03:00
|
|
|
::
|
|
|
|
+| %batch-comments
|
2022-07-01 20:48:48 +03:00
|
|
|
:> +b-foo: a foo
|
|
|
|
:> $b-baz: a baz
|
2022-07-06 23:21:13 +03:00
|
|
|
:> +b-bar: a bar
|
|
|
|
:>
|
|
|
|
:> a very bar foo
|
|
|
|
:>
|
|
|
|
:> $b-boz: a boz
|
|
|
|
:>
|
2022-07-01 17:39:01 +03:00
|
|
|
:> a very boz baz
|
2022-07-06 23:21:13 +03:00
|
|
|
:>
|
2022-07-01 20:48:48 +03:00
|
|
|
++ b-foo ~
|
|
|
|
++ b-bar ~
|
|
|
|
+$ b-baz *
|
|
|
|
+$ b-boz *
|
2022-07-01 17:39:01 +03:00
|
|
|
::
|
2022-05-09 21:57:43 +03:00
|
|
|
+| %docs-for-arms
|
|
|
|
++ no-doc ~
|
|
|
|
::
|
2022-06-28 20:30:40 +03:00
|
|
|
:> +arm-adoc-pre: arm-doc
|
2022-05-09 21:57:43 +03:00
|
|
|
++ arm-adoc-pre ~
|
|
|
|
::
|
|
|
|
++ arm-adoc-post :< arm-doc
|
|
|
|
~
|
|
|
|
::
|
|
|
|
++ arm-pdoc-pre
|
2022-07-06 23:21:13 +03:00
|
|
|
:> product-doc
|
2022-05-09 21:57:43 +03:00
|
|
|
'foo'
|
|
|
|
++ arm-pdoc-post
|
|
|
|
'foo' :< product-doc
|
|
|
|
::
|
|
|
|
++ arm-cdoc-pre
|
|
|
|
|%
|
2022-07-06 23:21:13 +03:00
|
|
|
:> core-doc
|
2022-05-09 21:57:43 +03:00
|
|
|
++ $ ~
|
|
|
|
--
|
|
|
|
::
|
|
|
|
++ arm-cdoc-post
|
|
|
|
|%
|
|
|
|
++ $ :< core-doc
|
|
|
|
~
|
|
|
|
--
|
|
|
|
::
|
2022-06-28 20:30:40 +03:00
|
|
|
:> +arm-adoc-pdoc-pre-pre: arm-doc
|
2022-05-09 21:57:43 +03:00
|
|
|
++ arm-adoc-pdoc-pre-pre
|
2022-07-06 23:21:13 +03:00
|
|
|
:> product-doc
|
2022-05-09 21:57:43 +03:00
|
|
|
'foo'
|
|
|
|
::
|
|
|
|
++ arm-adoc-pdoc-post-pre :< arm-doc
|
2022-07-06 23:21:13 +03:00
|
|
|
:> product-doc
|
2022-05-09 21:57:43 +03:00
|
|
|
'foo'
|
|
|
|
::
|
|
|
|
++ arm-adoc-pdoc-post-post :< arm-doc
|
|
|
|
'foo' :< product-doc
|
|
|
|
::
|
2022-06-28 20:30:40 +03:00
|
|
|
:> +arm-adoc-cdoc-pre-pre: arm-doc
|
2022-05-09 21:57:43 +03:00
|
|
|
++ arm-adoc-cdoc-pre-pre
|
|
|
|
|%
|
2022-07-06 23:21:13 +03:00
|
|
|
:> core-doc
|
2022-05-09 21:57:43 +03:00
|
|
|
++ $ ~
|
|
|
|
--
|
|
|
|
::
|
|
|
|
++ arm-adoc-cdoc-post-pre :< arm-doc
|
|
|
|
|%
|
2022-07-06 23:21:13 +03:00
|
|
|
:> core-doc
|
2022-05-09 21:57:43 +03:00
|
|
|
++ $ ~
|
|
|
|
--
|
|
|
|
::
|
|
|
|
++ arm-adoc-cdoc-post-post :< arm-doc
|
|
|
|
|%
|
|
|
|
++ $ :< core-doc
|
|
|
|
~
|
|
|
|
--
|
|
|
|
::
|
|
|
|
++ arm-pdoc-cdoc-pre-pre
|
2022-07-06 23:21:13 +03:00
|
|
|
:> product-doc
|
2022-05-09 21:57:43 +03:00
|
|
|
|%
|
2022-07-06 23:21:13 +03:00
|
|
|
:> core-doc
|
2022-05-09 21:57:43 +03:00
|
|
|
++ $ ~
|
|
|
|
--
|
|
|
|
++ arm-pdoc-cdoc-post-pre
|
|
|
|
|%
|
2022-07-06 23:21:13 +03:00
|
|
|
:> core-doc
|
2022-05-09 21:57:43 +03:00
|
|
|
++ $ ~
|
|
|
|
-- :< product-doc
|
|
|
|
::
|
|
|
|
++ arm-pdoc-cdoc-post-post
|
|
|
|
|%
|
|
|
|
++ $ :< core-doc
|
|
|
|
~
|
|
|
|
-- :< product-doc
|
|
|
|
::
|
2022-06-28 20:30:40 +03:00
|
|
|
:> +arm-adoc-pdoc-cdoc-pre-pre-pre: arm-doc
|
2022-05-09 21:57:43 +03:00
|
|
|
++ arm-adoc-pdoc-cdoc-pre-pre-pre
|
2022-07-06 23:21:13 +03:00
|
|
|
:> product-doc
|
2022-05-09 21:57:43 +03:00
|
|
|
|%
|
2022-07-06 23:21:13 +03:00
|
|
|
:> core-doc
|
2022-05-09 21:57:43 +03:00
|
|
|
++ $ ~
|
|
|
|
--
|
|
|
|
::
|
|
|
|
++ arm-adoc-pdoc-cdoc-post-pre-pre :< arm-doc
|
2022-07-06 23:21:13 +03:00
|
|
|
:> product-doc
|
2022-05-09 21:57:43 +03:00
|
|
|
|%
|
2022-07-06 23:21:13 +03:00
|
|
|
:> core-doc
|
2022-05-09 21:57:43 +03:00
|
|
|
++ $ ~
|
|
|
|
--
|
|
|
|
::
|
2022-06-28 20:30:40 +03:00
|
|
|
:> +arm-adoc-pdoc-cdoc-pre-post-pre: arm-doc
|
2022-05-09 21:57:43 +03:00
|
|
|
++ arm-adoc-pdoc-cdoc-pre-post-pre
|
|
|
|
|%
|
2022-07-06 23:21:13 +03:00
|
|
|
:> core-doc
|
2022-05-09 21:57:43 +03:00
|
|
|
++ $ ~
|
|
|
|
-- :< product-doc
|
|
|
|
::
|
2022-06-28 20:30:40 +03:00
|
|
|
:> +arm-adoc-pdoc-cdoc-pre-pre-post: arm-doc
|
2022-05-09 21:57:43 +03:00
|
|
|
++ arm-adoc-pdoc-cdoc-pre-pre-post
|
2022-07-06 23:21:13 +03:00
|
|
|
:> product-doc
|
2022-05-09 21:57:43 +03:00
|
|
|
|%
|
|
|
|
++ $ :< core-doc
|
|
|
|
~
|
|
|
|
--
|
|
|
|
::
|
|
|
|
++ arm-adoc-pdoc-cdoc-post-post-pre :< arm-doc
|
|
|
|
|%
|
2022-07-06 23:21:13 +03:00
|
|
|
:> core-doc
|
2022-05-09 21:57:43 +03:00
|
|
|
++ $ ~
|
|
|
|
-- :< product-doc
|
|
|
|
::
|
|
|
|
++ arm-adoc-pdoc-cdoc-post-pre-post :< arm-doc
|
2022-07-06 23:21:13 +03:00
|
|
|
:> product-doc
|
2022-05-09 21:57:43 +03:00
|
|
|
|%
|
|
|
|
++ $ :< core-doc
|
|
|
|
~
|
|
|
|
--
|
|
|
|
::
|
2022-06-28 20:30:40 +03:00
|
|
|
:> +arm-adoc-pdoc-cdoc-pre-post-post: arm-doc
|
2022-05-09 21:57:43 +03:00
|
|
|
++ arm-adoc-pdoc-cdoc-pre-post-post
|
|
|
|
|%
|
|
|
|
++ $ :< core-doc
|
|
|
|
~
|
|
|
|
-- :< product-doc
|
|
|
|
::
|
|
|
|
++ arm-adoc-pdoc-cdoc-post-post-post :< arm-doc
|
|
|
|
|%
|
|
|
|
++ $ :< core-doc
|
|
|
|
~
|
|
|
|
-- :< product-doc
|
|
|
|
::
|
|
|
|
--
|
|
|
|
::
|
|
|
|
:> contains the actual tests to be run by -test
|
2022-06-07 19:37:32 +03:00
|
|
|
|% %dprint-tests
|
2022-07-01 20:48:48 +03:00
|
|
|
+| %batch-tests
|
|
|
|
++ test-b-foo
|
|
|
|
%+ expect-eq
|
|
|
|
!> ^- arm-dox
|
|
|
|
["b-foo" `['a foo' ~] *what *what]
|
|
|
|
::
|
|
|
|
!> (get-arm-dox ~[%b-foo])
|
|
|
|
::
|
|
|
|
++ test-b-bar
|
|
|
|
%+ expect-eq
|
|
|
|
!> ^- arm-dox
|
|
|
|
["b-bar" `['a bar' ~[~[[& 'a very bar foo']]]] *what *what]
|
|
|
|
::
|
|
|
|
!> (get-arm-dox ~[%b-bar])
|
|
|
|
::
|
|
|
|
++ test-b-baz
|
|
|
|
%+ expect-eq
|
|
|
|
!> ^- arm-dox
|
|
|
|
["b-baz" `['a baz' ~] *what *what]
|
|
|
|
::
|
|
|
|
!> (get-arm-dox ~[%b-baz])
|
|
|
|
::
|
|
|
|
++ test-b-boz
|
|
|
|
%+ expect-eq
|
|
|
|
!> ^- arm-dox
|
|
|
|
["b-boz" `['a boz' ~[~[[& 'a very boz baz']]]] *what *what]
|
|
|
|
::
|
|
|
|
!> (get-arm-dox ~[%b-boz])
|
|
|
|
::
|
2022-07-01 17:39:01 +03:00
|
|
|
+| %arm-tests
|
|
|
|
::
|
2022-05-09 21:57:43 +03:00
|
|
|
++ test-no-doc
|
|
|
|
%+ expect-eq
|
|
|
|
!> ^- arm-dox
|
|
|
|
["no-doc" *what *what *what]
|
2022-06-09 18:52:38 +03:00
|
|
|
::
|
|
|
|
!> (get-arm-dox ~[%no-doc])
|
2022-05-09 21:57:43 +03:00
|
|
|
::
|
2022-07-01 17:39:01 +03:00
|
|
|
++ test-adoc (run-arm-tests & | |)
|
|
|
|
++ test-pdoc (run-arm-tests | & |)
|
|
|
|
++ test-cdoc (run-arm-tests | | &)
|
|
|
|
++ test-adoc-pdoc (run-arm-tests & & |)
|
|
|
|
++ test-adoc-cdoc (run-arm-tests & | &)
|
|
|
|
++ test-pdoc-cdoc (run-arm-tests | & &)
|
|
|
|
++ test-adoc-pdoc-cdoc (run-arm-tests & & &)
|
2022-05-09 23:01:32 +03:00
|
|
|
::
|
2022-07-01 17:39:01 +03:00
|
|
|
+| %core-tests
|
2022-05-09 23:01:32 +03:00
|
|
|
++ test-core
|
|
|
|
%+ expect-eq
|
|
|
|
!> ^- core-dox
|
2022-05-09 23:45:16 +03:00
|
|
|
["core-test" `['core-summary' ~[~[[%.y 'core-description']]]]]
|
2022-06-09 18:52:38 +03:00
|
|
|
::
|
|
|
|
!> (get-core-dox ~[%core-test])
|
2022-05-09 23:45:16 +03:00
|
|
|
::
|
|
|
|
++ test-chapter
|
|
|
|
%+ expect-eq
|
|
|
|
!> ^- chapter-dox
|
|
|
|
["chapter-test" `['chapter-summary' ~[~[[%.y 'chapter-description']]]]]
|
2022-06-09 18:52:38 +03:00
|
|
|
::
|
|
|
|
!> (get-chapter-dox ~[%core-test %chapter-test])
|
2022-05-09 23:45:16 +03:00
|
|
|
::
|
2022-05-09 21:57:43 +03:00
|
|
|
--
|