factor/library/test/namespaces.factor

51 lines
1.0 KiB
Factor
Raw Normal View History

2004-08-04 03:12:55 -04:00
IN: scratchpad
USE: kernel
USE: namespaces
USE: test
USE: words
<namespace> "test-namespace" set
: test-namespace ( -- )
<namespace> dup [ namespace = ] bind ;
[ t ] [ test-namespace ] unit-test
! Object paths should not resolve further up in the namestack.
<namespace> "test-namespace" set
[ f ]
[ [ "test-namespace" "test-namespace" ] object-path ]
unit-test
[ f ]
[ [ "alalal" "boobobo" "bah" ] object-path ]
unit-test
[ t ]
[ namespace [ ] object-path = ]
2004-08-04 03:12:55 -04:00
unit-test
[ t ]
[
\ test-word
global [ [ vocabularies "test" "test-word" ] object-path ] bind
2004-08-04 03:12:55 -04:00
=
] unit-test
10 "some-global" set
[ f ]
[ <namespace> [ f "some-global" set "some-global" get ] bind ]
unit-test
2004-10-09 21:43:14 -04:00
[
5 [ "test" "object" "path" ] set-object-path
[ 5 ] [ [ "test" "object" "path" ] object-path ] unit-test
7 [ "test" "object" "pathe" ] set-object-path
[ 7 ] [ [ "test" "object" "pathe" ] object-path ] unit-test
9 [ "teste" "object" "pathe" ] set-object-path
[ 9 ] [ [ "teste" "object" "pathe" ] object-path ] unit-test
] with-scope