2007-09-20 18:09:08 -04:00
|
|
|
USING: kernel namespaces tools.test words ;
|
2008-04-26 03:01:06 -04:00
|
|
|
IN: namespaces.tests
|
2007-09-20 18:09:08 -04:00
|
|
|
|
|
|
|
H{ } clone "test-namespace" set
|
|
|
|
|
2009-02-20 21:51:51 -05:00
|
|
|
: test-namespace ( -- ? )
|
2007-09-20 18:09:08 -04:00
|
|
|
H{ } clone dup [ namespace = ] bind ;
|
|
|
|
|
|
|
|
[ t ] [ test-namespace ] unit-test
|
|
|
|
|
|
|
|
10 "some-global" set
|
|
|
|
[ f ]
|
|
|
|
[ H{ } clone [ f "some-global" set "some-global" get ] bind ]
|
|
|
|
unit-test
|
2009-02-10 14:02:33 -05:00
|
|
|
|
|
|
|
SYMBOL: test-initialize
|
2009-02-20 21:51:51 -05:00
|
|
|
|
|
|
|
f test-initialize set-global
|
|
|
|
|
2009-02-10 14:02:33 -05:00
|
|
|
test-initialize [ 1 ] initialize
|
|
|
|
test-initialize [ 2 ] initialize
|
|
|
|
|
|
|
|
[ 1 ] [ test-initialize get-global ] unit-test
|
|
|
|
|
|
|
|
f test-initialize set-global
|
|
|
|
test-initialize [ 5 ] initialize
|
|
|
|
|
|
|
|
[ 5 ] [ test-initialize get-global ] unit-test
|