1 USING: accessors arrays assocs definitions fry generic help
2 help.markup io.streams.string kernel math namespaces parser
3 sequences sets strings tools.test words ;
4 FROM: namespaces => set ;
7 : with-markup-test ( quot -- )
9 '[ _ with-string-writer ] with-variable ; inline
11 TUPLE: blahblah quux ;
13 { "int" } [ [ { "int" } $instance ] with-markup-test ] unit-test
15 { } [ \ quux>> print-topic ] unit-test
16 { } [ \ >>quux print-topic ] unit-test
17 { } [ \ blahblah? print-topic ] unit-test
19 : fooey ( -- * ) "fooey" throw ;
21 { } [ \ fooey print-topic ] unit-test
23 { } [ gensym print-topic ] unit-test
26 [ [ { $or string } print-element ] with-markup-test ] unit-test
28 { "a string or an integer" }
29 [ [ { $or string integer } print-element ] with-markup-test ] unit-test
31 { "a string, a fixnum, or an integer" }
32 [ [ { $or string fixnum integer } print-element ] with-markup-test ] unit-test
37 [ [ { "span" } print-content ] with-markup-test ] unit-test
40 [ [ { "span1" "span2" } print-content ] with-markup-test ] unit-test
43 [ [ { "span1" { $nl } "span2" } print-content ] with-markup-test ] unit-test
46 [ [ { { $nl } "span" } print-content ] with-markup-test ] unit-test
49 [ [ { { $code "2 2 +" } "span" } print-content ] with-markup-test ] unit-test
52 [ [ { { $code "2 2 +" } } print-content ] with-markup-test ] unit-test
55 [ [ { "span" { $code "2 2 +" } } print-content ] with-markup-test ] unit-test
58 [ [ { { $nl } { $code "2 2 +" } } print-content ] with-markup-test ] unit-test
61 [ [ { "span" { $nl } { $code "2 2 +" } } print-content ] with-markup-test ] unit-test
64 [ [ { { $heading "Heading" } } print-content ] with-markup-test ] unit-test
66 { "Heading1\n\nHeading2" }
67 [ [ { { $heading "Heading1" } { $heading "Heading2" } } print-content ] with-markup-test ] unit-test
70 [ [ { "span" { $heading "Heading" } } print-content ] with-markup-test ] unit-test
73 [ [ { { $nl } { $heading "Heading" } } print-content ] with-markup-test ] unit-test
76 [ [ { "span" { $nl } { $heading "Heading" } } print-content ] with-markup-test ] unit-test
78 : word-related-words ( word -- word related-words )
79 dup [ "related" word-prop ] [ 1array ] bi diff ;
93 { 1foo 2foo 3foo } related-words
94 { 1bar 2bar 3bar } related-words
96 1foo word-related-words
97 1bar word-related-words
99 { 2foo 3foo } related-words
100 { 1foo 1bar } related-words
102 1foo word-related-words
103 2foo word-related-words
104 2bar word-related-words