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 ;
6 : with-markup-test ( quot -- )
8 '[ _ with-string-writer ] with-variable ; inline
10 TUPLE: blahblah quux ;
12 { "int" } [ [ { "int" } $instance ] with-markup-test ] unit-test
14 { } [ \ quux>> print-topic ] unit-test
15 { } [ \ >>quux print-topic ] unit-test
16 { } [ \ blahblah? print-topic ] unit-test
18 : fooey ( -- * ) "fooey" throw ;
20 { } [ \ fooey print-topic ] unit-test
22 { } [ gensym print-topic ] unit-test
25 [ [ { $or string } print-element ] with-markup-test ] unit-test
27 { "a string or an integer" }
28 [ [ { $or string integer } print-element ] with-markup-test ] unit-test
30 { "a string, a fixnum, or an integer" }
31 [ [ { $or string fixnum integer } print-element ] with-markup-test ] unit-test
36 [ [ { "span" } print-content ] with-markup-test ] unit-test
39 [ [ { "span1" "span2" } print-content ] with-markup-test ] unit-test
42 [ [ { "span1" { $nl } "span2" } print-content ] with-markup-test ] unit-test
45 [ [ { { $nl } "span" } print-content ] with-markup-test ] unit-test
48 [ [ { { $code "2 2 +" } "span" } print-content ] with-markup-test ] unit-test
51 [ [ { { $code "2 2 +" } } print-content ] with-markup-test ] unit-test
54 [ [ { "span" { $code "2 2 +" } } print-content ] with-markup-test ] unit-test
57 [ [ { { $nl } { $code "2 2 +" } } print-content ] with-markup-test ] unit-test
60 [ [ { "span" { $nl } { $code "2 2 +" } } print-content ] with-markup-test ] unit-test
63 [ [ { { $heading "Heading" } } print-content ] with-markup-test ] unit-test
65 { "Heading1\n\nHeading2" }
66 [ [ { { $heading "Heading1" } { $heading "Heading2" } } print-content ] with-markup-test ] unit-test
69 [ [ { "span" { $heading "Heading" } } print-content ] with-markup-test ] unit-test
72 [ [ { { $nl } { $heading "Heading" } } print-content ] with-markup-test ] unit-test
75 [ [ { "span" { $nl } { $heading "Heading" } } print-content ] with-markup-test ] unit-test
77 : word-related-words ( word -- word related-words )
78 dup [ "related" word-prop ] [ 1array ] bi diff ;
92 { 1foo 2foo 3foo } related-words
93 { 1bar 2bar 3bar } related-words
95 1foo word-related-words
96 1bar word-related-words
98 { 2foo 3foo } related-words
99 { 1foo 1bar } related-words
101 1foo word-related-words
102 2foo word-related-words
103 2bar word-related-words