1 USING: vocabs.loader tools.test continuations vocabs math
2 kernel arrays sequences namespaces io.streams.string sets
3 parser source-files words assocs classes.tuple definitions
4 debugger compiler.units accessors eval vocabs.hierarchy
5 combinators vocabs.parser grouping vocabs.files vocabs.refresh ;
6 IN: vocabs.loader.tests
8 ! This vocab should not exist, but just in case...
11 "vocabs.loader.test" forget-vocab
12 ] with-compilation-unit
15 [ T{ vocab-link f "vocabs.loader.test" } ]
16 [ "vocabs.loader.test" >vocab-link ] unit-test
19 [ "kernel" >vocab-link "kernel" lookup-vocab = ] unit-test
21 IN: vocabs.loader.test.2
27 IN: vocabs.loader.tests
30 "vocabs.loader.test.2" run
31 "vocabs.loader.test.2" lookup-vocab run
32 "vocabs.loader.test.2" <vocab-link> run
36 "resource:core/vocabs/loader/test/a/a.factor" forget-source
37 "vocabs.loader.test.a" forget-vocab
38 ] with-compilation-unit
40 0 "count-me" set-global
43 [ "vocabs.loader.test.a" require ] must-fail
45 [ f ] [ "vocabs.loader.test.a" lookup-vocab source-loaded?>> ] unit-test
48 "resource:core/vocabs/loader/test/a/a.factor"
49 source-file definitions>> dup USE: prettyprint .
50 "v-l-t-a-hello" "vocabs.loader.test.a" lookup-word dup .
55 [ 2 ] [ "count-me" get-global ] unit-test
58 "IN: vocabs.loader.test.a v-l-t-a-hello"
60 "resource:core/vocabs/loader/test/a/a.factor"
62 ] [ error>> error>> error>> no-word-error? ] must-fail-with
64 0 "count-me" set-global
68 "vocabs.loader.test.b" forget-vocab
69 ] with-compilation-unit
72 [ f ] [ "vocabs.loader.test.b" vocab-files empty? ] unit-test
76 "vocabs.loader.test.b" vocab-files
77 [ forget-source ] each
78 ] with-compilation-unit
81 [ "vocabs.loader.test.b" require ] must-fail
83 [ 1 ] [ "count-me" get-global ] unit-test
87 "bob" "vocabs.loader.test.b" create [ ] define
88 ] with-compilation-unit
91 [ ] [ "vocabs.loader.test.b" refresh ] unit-test
93 [ 2 ] [ "count-me" get-global ] unit-test
95 [ f ] [ "fred" "vocabs.loader.test.b" lookup-word undefined-word? ] unit-test
99 "vocabs.loader.test.b" vocab-files
100 [ forget-source ] each
101 ] with-compilation-unit
104 [ ] [ "vocabs.loader.test.b" changed-vocab ] unit-test
106 [ ] [ "vocabs.loader.test.b" refresh ] unit-test
108 [ 3 ] [ "count-me" get-global ] unit-test
110 [ { "resource:core/kernel/kernel.factor" 1 } ]
111 [ "kernel" <vocab-link> where ] unit-test
113 [ { "resource:core/kernel/kernel.factor" 1 } ]
114 [ "kernel" lookup-vocab where ] unit-test
118 "vocabs.loader.test.c" forget-vocab
119 "vocabs.loader.test.d" forget-vocab
120 ] with-compilation-unit
124 [ "vocabs.loader.test.d" require ] [ :1 ] recover
125 "vocabs.loader.test.d" lookup-vocab source-loaded?>>
130 { "2" "a" "b" "d" "e" "f" }
132 "vocabs.loader.test." prepend forget-vocab
134 ] with-compilation-unit ;
139 "IN: xabbabbja" eval( -- ) "xabbabbja" vocab-files
142 [ "xabbabbja" forget-vocab ] with-compilation-unit
146 [ ] [ [ "vocabs.loader.test.e" forget-vocab ] with-compilation-unit ] unit-test
148 0 "vocabs.loader.test.g" set-global
151 "vocabs.loader.test.f" forget-vocab
152 "vocabs.loader.test.g" forget-vocab
153 ] with-compilation-unit
155 [ ] [ "vocabs.loader.test.g" require ] unit-test
157 [ 1 ] [ "vocabs.loader.test.g" get-global ] unit-test
160 "vocabs.loader.test.h" forget-vocab
161 "vocabs.loader.test.i" forget-vocab
162 ] with-compilation-unit
164 [ ] [ "vocabs.loader.test.h" require ] unit-test
168 "vocabs.loader.test.j" forget-vocab
169 "vocabs.loader.test.k" forget-vocab
170 ] with-compilation-unit
172 [ ] [ [ "vocabs.loader.test.j" require ] [ drop :1 ] recover ] unit-test
174 [ ] [ "vocabs.loader.test.m" require ] unit-test
175 [ f ] [ "vocabs.loader.test.n" lookup-vocab ] unit-test
176 [ ] [ "vocabs.loader.test.o" require ] unit-test
177 [ t ] [ "vocabs.loader.test.n" lookup-vocab >boolean ] unit-test
180 "mno" [ "vocabs.loader.test." swap suffix forget-vocab ] each
181 ] with-compilation-unit
183 [ ] [ "vocabs.loader.test.o" require ] unit-test
184 [ f ] [ "vocabs.loader.test.n" lookup-vocab ] unit-test
185 [ ] [ "vocabs.loader.test.m" require ] unit-test
186 [ t ] [ "vocabs.loader.test.n" lookup-vocab >boolean ] unit-test
188 [ f ] [ "vocabs.loader.test.p" lookup-vocab ] unit-test
189 [ ] [ "vocabs.loader.test.p.private" require ] unit-test
190 [ { "foo" } ] [ "vocabs.loader.test.p" words [ name>> ] map ] unit-test
193 "mnop" [ "vocabs.loader.test." swap suffix forget-vocab ] each
194 ] with-compilation-unit