2004-11-28 19:07:24 -05:00
|
|
|
IN: scratchpad
|
|
|
|
USE: hashtables
|
|
|
|
USE: namespaces
|
|
|
|
USE: generic
|
|
|
|
USE: test
|
2004-12-10 19:29:07 -05:00
|
|
|
USE: kernel
|
2004-11-28 19:07:24 -05:00
|
|
|
|
|
|
|
TRAITS: test-traits
|
2004-12-11 18:18:43 -05:00
|
|
|
C: test-traits ;
|
2004-11-28 19:07:24 -05:00
|
|
|
|
|
|
|
[ t ] [ <test-traits> test-traits? ] unit-test
|
|
|
|
[ f ] [ "hello" test-traits? ] unit-test
|
|
|
|
[ f ] [ <namespace> test-traits? ] unit-test
|
|
|
|
|
|
|
|
GENERIC: foo
|
|
|
|
|
2004-12-11 18:18:43 -05:00
|
|
|
M: test-traits foo drop 12 ;
|
2004-11-28 19:07:24 -05:00
|
|
|
|
|
|
|
TRAITS: another-test
|
2004-12-11 18:18:43 -05:00
|
|
|
C: another-test ;
|
2004-11-28 19:07:24 -05:00
|
|
|
|
2004-12-11 18:18:43 -05:00
|
|
|
M: another-test foo drop 13 ;
|
2004-11-28 19:07:24 -05:00
|
|
|
|
|
|
|
[ 12 ] [ <test-traits> foo ] unit-test
|
|
|
|
[ 13 ] [ <another-test> foo ] unit-test
|
|
|
|
|
|
|
|
TRAITS: quux
|
2004-12-11 18:18:43 -05:00
|
|
|
C: quux ;
|
2004-11-28 19:07:24 -05:00
|
|
|
|
2004-12-11 18:18:43 -05:00
|
|
|
M: quux foo "foo" swap hash ;
|
2004-11-28 19:07:24 -05:00
|
|
|
|
|
|
|
[
|
|
|
|
"Hi"
|
|
|
|
] [
|
|
|
|
<quux> [
|
|
|
|
"Hi" "foo" set
|
|
|
|
] extend foo
|
|
|
|
] unit-test
|
|
|
|
|
|
|
|
TRAITS: ctr-test
|
2004-12-11 18:18:43 -05:00
|
|
|
C: ctr-test [ 5 "x" set ] extend ;
|
2004-11-28 19:07:24 -05:00
|
|
|
|
|
|
|
[
|
|
|
|
5
|
|
|
|
] [
|
|
|
|
<ctr-test> [ "x" get ] bind
|
|
|
|
] unit-test
|
|
|
|
|
|
|
|
TRAITS: del1
|
2004-12-11 18:18:43 -05:00
|
|
|
C: del1 ;
|
2004-11-28 19:07:24 -05:00
|
|
|
|
|
|
|
GENERIC: super
|
2004-12-11 18:18:43 -05:00
|
|
|
M: del1 super drop 5 ;
|
2004-11-28 19:07:24 -05:00
|
|
|
|
|
|
|
TRAITS: del2
|
2004-12-11 18:18:43 -05:00
|
|
|
C: del2 ( delegate -- del2 ) [ delegate set ] extend ;
|
2004-11-28 19:07:24 -05:00
|
|
|
|
|
|
|
[ 5 ] [ <del1> <del2> super ] unit-test
|