]> gitweb.factorcode.org Git - factor.git/blob - library/test/namespaces/namespaces.factor
working on the test suite
[factor.git] / library / test / namespaces / namespaces.factor
1 IN: scratchpad
2 USE: kernel
3 USE: namespaces
4 USE: test
5 USE: stack
6 USE: words
7 USE: vocabularies
8
9 <namespace> "test-namespace" set
10
11 : test-namespace ( -- )
12     <namespace> dup [ namespace = ] bind ;
13
14 : test-this-1 ( -- )
15     <namespace> dup [ this = ] bind ;
16
17 [ t ] [ test-namespace ] unit-test
18 [ t ] [ test-this-1    ] unit-test
19
20 ! Object paths should not resolve further up in the namestack.
21
22 <namespace> "test-namespace" set
23 [ f ]
24 [ [ "test-namespace" "test-namespace" ] object-path ]
25 unit-test
26
27 [ f ]
28 [ [ "alalal" "boobobo" "bah" ] object-path ]
29 unit-test
30
31 [ t ]
32 [ this [ ] object-path = ]
33 unit-test
34
35 [ t ]
36 [
37     "test-word" intern
38     [ "vocabularies" "test" "test-word" ] object-path
39     =
40 ] unit-test
41
42 10 "some-global" set
43 [ f ]
44 [ <namespace> [ f "some-global" set "some-global" get ] bind ]
45 unit-test