1 IN: vocabs.loader.tests
2 USING: vocabs.loader tools.test continuations vocabs math
3 kernel arrays sequences namespaces io.streams.string
4 parser source-files words assocs classes.tuple definitions
5 debugger compiler.units tools.vocabs accessors eval
6 combinators vocabs.parser grouping ;
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" vocab = ] unit-test
23 "kernel" vocab vocab-files
24 "kernel" <vocab-link> vocab-files
28 IN: vocabs.loader.test.2
34 IN: vocabs.loader.tests
37 "vocabs.loader.test.2" run
38 "vocabs.loader.test.2" vocab run
39 "vocabs.loader.test.2" <vocab-link> run
45 "resource:core/vocabs/loader/test/a/a.factor" forget-source
46 "vocabs.loader.test.a" forget-vocab
47 ] with-compilation-unit
49 0 "count-me" set-global
52 [ "vocabs.loader.test.a" require ] must-fail
54 [ f ] [ "vocabs.loader.test.a" vocab source-loaded?>> ] unit-test
57 "resource:core/vocabs/loader/test/a/a.factor"
58 source-file definitions>> dup USE: prettyprint .
59 "v-l-t-a-hello" "vocabs.loader.test.a" lookup dup .
64 [ 2 ] [ "count-me" get-global ] unit-test
67 "IN: vocabs.loader.test.a v-l-t-a-hello"
69 "resource:core/vocabs/loader/test/a/a.factor"
71 ] [ error>> error>> error>> no-word-error? ] must-fail-with
73 0 "count-me" set-global
77 "vocabs.loader.test.b" forget-vocab
78 ] with-compilation-unit
81 [ f ] [ "vocabs.loader.test.b" vocab-files empty? ] unit-test
85 "vocabs.loader.test.b" vocab-files
86 [ forget-source ] each
87 ] with-compilation-unit
90 [ "vocabs.loader.test.b" require ] must-fail
92 [ 1 ] [ "count-me" get-global ] unit-test
96 "bob" "vocabs.loader.test.b" create [ ] define
97 ] with-compilation-unit
100 [ ] [ "vocabs.loader.test.b" refresh ] unit-test
102 [ 2 ] [ "count-me" get-global ] unit-test
104 [ f ] [ "fred" "vocabs.loader.test.b" lookup undefined? ] unit-test
108 "vocabs.loader.test.b" vocab-files
109 [ forget-source ] each
110 ] with-compilation-unit
113 [ ] [ "vocabs.loader.test.b" changed-vocab ] unit-test
115 [ ] [ "vocabs.loader.test.b" refresh ] unit-test
117 [ 3 ] [ "count-me" get-global ] unit-test
119 [ { "resource:core/kernel/kernel.factor" 1 } ]
120 [ "kernel" <vocab-link> where ] unit-test
122 [ { "resource:core/kernel/kernel.factor" 1 } ]
123 [ "kernel" vocab where ] unit-test
127 "vocabs.loader.test.c" forget-vocab
128 "vocabs.loader.test.d" forget-vocab
129 ] with-compilation-unit
133 [ "vocabs.loader.test.d" require ] [ :1 ] recover
134 "vocabs.loader.test.d" vocab source-loaded?>>
139 { "2" "a" "b" "d" "e" "f" }
141 "vocabs.loader.test." prepend forget-vocab
143 ] with-compilation-unit ;
148 "IN: xabbabbja" eval "xabbabbja" vocab-files
151 [ "xabbabbja" forget-vocab ] with-compilation-unit
155 [ ] [ [ "vocabs.loader.test.e" forget-vocab ] with-compilation-unit ] unit-test
157 0 "vocabs.loader.test.g" set-global
160 "vocabs.loader.test.f" forget-vocab
161 "vocabs.loader.test.g" forget-vocab
162 ] with-compilation-unit
164 [ ] [ "vocabs.loader.test.g" require ] unit-test
166 [ 1 ] [ "vocabs.loader.test.g" get-global ] unit-test
169 "vocabs.loader.test.h" forget-vocab
170 "vocabs.loader.test.i" forget-vocab
171 ] with-compilation-unit
173 [ ] [ "vocabs.loader.test.h" require ] unit-test
177 "vocabs.loader.test.j" forget-vocab
178 "vocabs.loader.test.k" forget-vocab
179 ] with-compilation-unit
181 [ ] [ [ "vocabs.loader.test.j" require ] [ drop :1 ] recover ] unit-test