factor/library/test/words.factor

58 lines
1.2 KiB
Factor
Raw Normal View History

2004-08-19 19:36:28 -04:00
IN: scratchpad
2004-08-26 22:21:17 -04:00
USE: math
2004-08-19 19:36:28 -04:00
USE: test
USE: words
2004-09-28 00:24:36 -04:00
USE: namespaces
USE: logic
USE: lists
2004-10-19 12:32:54 -04:00
USE: stack
USE: kernel
2004-08-19 19:36:28 -04:00
[ 4 ] [
"poo" "scratchpad" create [ 2 2 + ] define-compound
"poo" [ "scratchpad" ] search execute
] unit-test
2004-09-28 00:24:36 -04:00
: words-test ( -- ? )
t vocabs [ words [ word? and ] each ] each ;
[ t ] [ ] [ words-test ] test-word
2004-10-16 21:55:13 -04:00
DEFER: plist-test
[ t ] [
\ plist-test t "sample-property" set-word-property
\ plist-test "sample-property" word-property
] unit-test
[ f ] [
\ plist-test f "sample-property" set-word-property
\ plist-test "sample-property" word-property
] unit-test
2004-09-28 00:24:36 -04:00
: test-last ( -- ) ;
word word-name "last-word-test" set
[ "test-last" ] [ ] [ "last-word-test" get ] test-word
[ f ] [ 5 ] [ compound? ] test-word
2004-10-17 16:04:49 -04:00
"create-test" "scratchpad" create { 1 2 } "testing" set-word-property
[ { 1 2 } ] [
"create-test" [ "scratchpad" ] search "testing" word-property
] unit-test
2004-10-19 12:32:54 -04:00
[
<namespace> "vocabularies" set
[ t ] [ \ car "car" [ "lists" ] search = ] unit-test
"test-scope" "scratchpad" create drop
] with-scope
[ "test-scope" ] [
"test-scope" [ "scratchpad" ] search word-name
] unit-test
[ t ] [ vocabs list? ] unit-test
[ t ] [ vocabs [ words [ word? ] all? ] all? ] unit-test