]> gitweb.factorcode.org Git - factor.git/blob - basis/help/crossref/crossref-tests.factor
4ed3f72140cbb5d819c58c080992e7189473fa72
[factor.git] / basis / help / crossref / crossref-tests.factor
1 USING: help.crossref help.topics help.markup tools.test words
2 definitions assocs sequences kernel namespaces parser arrays
3 io.streams.string continuations debugger compiler.units eval
4 help.syntax ;
5 IN: help.crossref.tests
6
7 [ ] [
8     "IN: help.crossref.tests USING: help.syntax help.markup ; : foo ( -- ) ; HELP: foo \"foo is great\" ; ARTICLE: \"foo\" \"Foo\" { $subsection foo } ;" eval( -- )
9 ] unit-test
10
11 [ $subsection ] [
12     "foo" article-content first first
13 ] unit-test
14
15 [ t ] [
16     "foo" article-children
17     "foo" "help.crossref.tests" lookup-word >link 1array sequence=
18 ] unit-test
19
20 [ "foo" ] [ "foo" "help.crossref.tests" lookup-word article-parent ] unit-test
21
22 [ ] [
23     [ "foo" "help.crossref.tests" lookup-word forget ] with-compilation-unit
24 ] unit-test
25
26 [ ] [
27     "IN: help.crossref.tests USING: help.syntax help.markup ; : bar ( -- ) ; HELP: bar \"bar is great\" ; ARTICLE: \"bar\" \"Bar\" { $subsection bar } ;" eval( -- )
28 ] unit-test
29
30 [ ] [
31     "IN: ayy USE: help.syntax ARTICLE: \"b\" \"B\" ;"
32     <string-reader> "ayy" parse-stream drop
33 ] unit-test
34
35 [ ] [
36     "IN: azz USE: help.syntax USE: help.markup ARTICLE: \"a\" \"A\" { $subsection \"b\" } ;"
37     <string-reader> "ayy" parse-stream drop
38 ] unit-test
39
40 [ ] [
41     "IN: ayy USE: help.syntax ARTICLE: \"c\" \"C\" ;"
42     <string-reader> "ayy" parse-stream drop
43 ] unit-test
44
45 [ ] [
46     "IN: azz USE: help.syntax USE: help.markup ARTICLE: \"a\" \"A\" { $subsection \"c\" } ;"
47     <string-reader> "ayy" parse-stream drop
48 ] unit-test
49
50 [ ] [
51     [
52         "IN: azz USE: help.syntax USE: help.markup ARTICLE: \"yyy\" \"YYY\" ; ARTICLE: \"xxx\" \"XXX\" { $subsection \"yyy\" } ; ARTICLE: \"yyy\" \"YYY\" ;"
53         <string-reader> "parent-test" parse-stream drop
54     ] [ :1 ] recover
55 ] unit-test
56
57 [ "xxx" ] [ "yyy" article-parent ] unit-test
58
59 ARTICLE: "crossref-test-1" "Crossref test 1"
60 "Hello world" ;
61
62 ARTICLE: "crossref-test-2" "Crossref test 2"
63 { $markup-example { $subsection "crossref-test-1" } } ;
64
65 [ { } ] [ "crossref-test-2" >link article-children ] unit-test