]> gitweb.factorcode.org Git - factor.git/blob - basis/listener/listener-tests.factor
ui.theme.switching.tools: switch breakpoint symbol
[factor.git] / basis / listener / listener-tests.factor
1 USING: compiler.units continuations definitions eval io
2 io.streams.string kernel listener listener.private math namespaces
3 parser parser.notes tools.test vocabs vocabs.parser words ;
4 IN: listener.tests
5
6 SYNTAX: hello "Hi" print ;
7
8 : parse-interactive ( string -- quot )
9     <string-reader> stream-read-quot ;
10
11 [
12     [ [ ] ] [
13         "USE: listener.tests hello" parse-interactive
14     ] unit-test
15 ] with-file-vocabs
16
17 [
18     [ [ \ + 1 2 3 4 ] ]
19     [
20         [
21             "cont" set
22             [
23                 "\\ + 1 2 3 4" parse-interactive
24                 "cont" get continue-with
25             ] ignore-errors
26             "USE: debugger :1" eval( -- quot )
27         ] callcc1
28     ] unit-test
29 ] with-file-vocabs
30
31 { } [
32     [
33         "vocabs.loader.test.c" forget-vocab
34     ] with-compilation-unit
35 ] unit-test
36
37 [
38     [
39         "USE: vocabs.loader.test.c" parse-interactive
40     ] must-fail
41 ] with-file-vocabs
42
43 { } [
44     [
45         "vocabs.loader.test.c" forget-vocab
46     ] with-compilation-unit
47 ] unit-test
48
49 [
50     [ ] [
51         "IN: listener.tests : hello ( -- string )\n\"world\" ;" parse-interactive
52         drop
53     ] unit-test
54 ] with-file-vocabs
55
56 [ "call" "scratchpad" create-word drop ] with-compilation-unit
57
58 [
59     { t }
60     [
61         "call" "scratchpad" lookup-word
62         [ "call" search ] with-interactive-vocabs
63         eq?
64     ] unit-test
65 ] with-file-vocabs
66
67 [ "call" "scratchpad" lookup-word forget ] with-compilation-unit
68
69 [
70     { t } [
71         "[ ]" [
72             t parser-quiet? [
73                 { } listener-step drop
74                 parser-quiet? get
75             ] with-variable
76         ] with-string-reader
77     ] unit-test
78 ] with-file-vocabs