1 ! Copyright (C) 2009 Doug Coleman.
2 ! See https://factorcode.org/license.txt for BSD license.
4 USING: help.markup io.streams.string kernel math sequences
5 tools.scaffold tools.scaffold.private tools.test unicode ;
7 IN: tools.scaffold.tests
10 : undocumented-word ( obj1 obj2 -- obj3 obj4 )
11 [ >lower ] [ >upper ] bi* ;
14 "HELP: undocumented-word
16 { \"obj1\" object } { \"obj2\" object }
17 { \"obj3\" object } { \"obj4\" object }
19 { $description \"\" } ;
23 [ \ undocumented-word scaffold-word-docs ] with-string-writer
28 { $class-description \"\" } ;
32 [ \ iota scaffold-word-docs ] with-string-writer
35 { sequence t } [ "seq" lookup-type ] unit-test
36 { sequence t } [ "seq'" lookup-type ] unit-test
37 { sequence t } [ "newseq" lookup-type ] unit-test
38 { { $maybe sequence } t } [ "seq/f" lookup-type ] unit-test
39 { f f } [ "foo" lookup-type ] unit-test
42 : test-maybe ( obj -- obj/f ) ;
48 { \"obj/f\" { $maybe object } }
50 { $description \"\" } ;
53 [ [ \ test-maybe scaffold-word-docs ] with-string-writer ]
56 { "{ \"foofoo\" } [\n USING: kernel sequences ; \"foo\" dup append\n] unit-test\n" } [
57 "USING: kernel sequences ; \"foo\" dup append" [ read-unit-test ] with-string-reader
61 "{\n \"foobarbazfoobarbazfoobarbazfoobarbazfoobarbazfoobarbazfoobarbazfoobarbaz\"\n} [\n USING: kernel math sequences ; \"foobarbaz\" 3 [ dup append ] times\n] unit-test\n"
63 "USING: kernel math sequences ; \"foobarbaz\" 3 [ dup append ] times"
64 [ read-unit-test ] with-string-reader
67 { "foobar [\n baz\n] unit-test\n" } [
68 "foobar" "baz" make-unit-test
72 { "foobar [\n foz\n baz\n] unit-test\n" } [
73 "foobar" "foz\nbaz" make-unit-test
77 "USING: math ; 2 1 + 3 * 7 -" run-string