More unit test fixes

db4
Slava Pestov 2008-03-08 04:27:19 -06:00
parent 09352a9327
commit 26df05b912
13 changed files with 47 additions and 41 deletions

View File

@ -1,4 +1,5 @@
USING: io.encodings.utf8 tools.test io.encodings.string strings arrays unicode ; USING: io.encodings.utf8 tools.test io.encodings.string strings arrays unicode ;
IN: io.encodings.utf8.tests
: decode-utf8-w/stream ( array -- newarray ) : decode-utf8-w/stream ( array -- newarray )
utf8 decode >array ; utf8 decode >array ;

1
extra/bitfields/bitfields-tests.factor Normal file → Executable file
View File

@ -1,4 +1,5 @@
USING: tools.test bitfields kernel ; USING: tools.test bitfields kernel ;
IN: bitfields.tests
SAFE-BITFIELD: foo bar:5 baz:10 111 bing:2 ; SAFE-BITFIELD: foo bar:5 baz:10 111 bing:2 ;

View File

@ -1,5 +1,6 @@
USING: arrays calendar kernel math sequences tools.test USING: arrays calendar kernel math sequences tools.test
continuations system ; continuations system ;
IN: calendar.tests
[ f ] [ 2004 12 32 0 0 0 0 <timestamp> valid-timestamp? ] unit-test [ f ] [ 2004 12 32 0 0 0 0 <timestamp> valid-timestamp? ] unit-test
[ f ] [ 2004 2 30 0 0 0 0 <timestamp> valid-timestamp? ] unit-test [ f ] [ 2004 2 30 0 0 0 0 <timestamp> valid-timestamp? ] unit-test

View File

@ -1,10 +1,10 @@
! Copyright (C) 2005, 2008 Chris Double, Doug Coleman. ! Copyright (C) 2005, 2008 Chris Double, Doug Coleman.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: alien arrays assocs classes compiler db USING: alien arrays assocs classes compiler db
hashtables io.files io.files.tmp kernel math math.parser namespaces hashtables io.files kernel math math.parser namespaces
prettyprint sequences strings tuples alien.c-types prettyprint sequences strings tuples alien.c-types
continuations db.sqlite.lib db.sqlite.ffi db.tuples continuations db.sqlite.lib db.sqlite.ffi db.tuples
words combinators.lib db.types combinators tools.walker words combinators.lib db.types combinators
combinators.cleave io namespaces.lib ; combinators.cleave io namespaces.lib ;
IN: db.sqlite IN: db.sqlite
@ -25,11 +25,6 @@ M: sqlite-db dispose ( db -- ) dispose-db ;
: with-sqlite ( path quot -- ) : with-sqlite ( path quot -- )
sqlite-db swap with-db ; inline sqlite-db swap with-db ; inline
: with-tmp-sqlite ( quot -- )
".db" [
swap with-sqlite
] with-tmpfile ;
TUPLE: sqlite-statement ; TUPLE: sqlite-statement ;
TUPLE: sqlite-result-set has-more? ; TUPLE: sqlite-result-set has-more? ;

1
extra/hash2/hash2-tests.factor Normal file → Executable file
View File

@ -1,4 +1,5 @@
USING: tools.test hash2 kernel ; USING: tools.test hash2 kernel ;
IN: hash2.tests
: sample-hash : sample-hash
5 <hash2> 5 <hash2>

55
extra/ldap/ldap-tests.factor Normal file → Executable file
View File

@ -1,5 +1,6 @@
USING: alien alien.c-types io kernel ldap ldap.libldap namespaces prettyprint USING: alien alien.c-types io kernel ldap ldap.libldap
tools.test ; namespaces prettyprint tools.test ;
IN: ldap.tests
"void*" <c-object> "ldap://localhost:389" initialize "void*" <c-object> "ldap://localhost:389" initialize
@ -11,47 +12,47 @@ get-ldp LDAP_OPT_PROTOCOL_VERSION LDAP_VERSION3 <int> set-option
] unit-test ] unit-test
[ [
get-ldp "cn=jimbob,dc=example,dc=com" "secret" [ get-ldp "cn=jimbob,dc=example,dc=com" "secret" [
! get-ldp "dc=example,dc=com" LDAP_SCOPE_ONELEVEL "(objectclass=*)" f 0 ! get-ldp "dc=example,dc=com" LDAP_SCOPE_ONELEVEL "(objectclass=*)" f 0
! "void*" <c-object> [ search-s ] keep *int . ! "void*" <c-object> [ search-s ] keep *int .
[ 2 ] [ [ 2 ] [
get-ldp "dc=example,dc=com" LDAP_SCOPE_SUBTREE "(objectclass=*)" f 0 get-ldp "dc=example,dc=com" LDAP_SCOPE_SUBTREE "(objectclass=*)" f 0
search search
] unit-test ] unit-test
! get-ldp LDAP_RES_ANY 0 f "void*" <c-object> result . ! get-ldp LDAP_RES_ANY 0 f "void*" <c-object> result .
get-ldp LDAP_RES_ANY LDAP_MSG_ALL f "void*" <c-object> result get-ldp LDAP_RES_ANY LDAP_MSG_ALL f "void*" <c-object> result
! get-message *int . ! get-message *int .
"Message ID: " write "Message ID: " write
get-message msgid . get-message msgid .
get-ldp get-message get-dn . get-ldp get-message get-dn .
"Entries count: " write "Entries count: " write
get-ldp get-message count-entries . get-ldp get-message count-entries .
SYMBOL: entry SYMBOL: entry
SYMBOL: attr SYMBOL: attr
"Attribute: " write "Attribute: " write
get-ldp get-message first-entry entry set get-ldp entry get get-ldp get-message first-entry entry set get-ldp entry get
"void*" <c-object> first-attribute dup . attr set "void*" <c-object> first-attribute dup . attr set
"Value: " write "Value: " write
get-ldp entry get attr get get-values *char* . get-ldp entry get attr get get-values *char* .
get-ldp get-message first-message msgtype result-type get-ldp get-message first-message msgtype result-type
get-ldp get-message next-message msgtype result-type get-ldp get-message next-message msgtype result-type
] with-bind ] with-bind
] drop ] drop

1
extra/multiline/multiline-tests.factor Normal file → Executable file
View File

@ -1,4 +1,5 @@
USING: multiline tools.test ; USING: multiline tools.test ;
IN: multiline.tests
STRING: test-it STRING: test-it
foo foo

1
extra/pdf/pdf-tests.factor Normal file → Executable file
View File

@ -1,4 +1,5 @@
USING: io.files kernel math namespaces pdf pdf.libhpdf prettyprint sequences ; USING: io.files kernel math namespaces pdf pdf.libhpdf prettyprint sequences ;
IN: pdf.tests
SYMBOL: font SYMBOL: font

1
extra/rss/rss-tests.factor Normal file → Executable file
View File

@ -1,4 +1,5 @@
USING: rss io kernel io.files tools.test io.encodings.utf8 ; USING: rss io kernel io.files tools.test io.encodings.utf8 ;
IN: rss.tests
: load-news-file ( filename -- feed ) : load-news-file ( filename -- feed )
#! Load an news syndication file and process it, returning #! Load an news syndication file and process it, returning

1
extra/sequences/deep/deep-tests.factor Normal file → Executable file
View File

@ -1,5 +1,6 @@
USING: sequences.deep kernel tools.test strings math arrays USING: sequences.deep kernel tools.test strings math arrays
namespaces sequences ; namespaces sequences ;
IN: sequences.deep.tests
[ [ "hello" 3 4 swap ] ] [ [ { "hello" V{ 3 4 } } swap ] flatten ] unit-test [ [ "hello" 3 4 swap ] ] [ [ { "hello" V{ 3 4 } } swap ] flatten ] unit-test

1
extra/tuple-arrays/tuple-arrays-tests.factor Normal file → Executable file
View File

@ -1,4 +1,5 @@
USING: tuple-arrays sequences tools.test namespaces kernel math ; USING: tuple-arrays sequences tools.test namespaces kernel math ;
IN: tuple-arrays.tests
SYMBOL: mat SYMBOL: mat
TUPLE: foo bar ; TUPLE: foo bar ;

1
extra/xml/tests/errors.factor Normal file → Executable file
View File

@ -1,4 +1,5 @@
USING: continuations xml xml.errors tools.test kernel arrays xml.data state-parser quotations ; USING: continuations xml xml.errors tools.test kernel arrays xml.data state-parser quotations ;
IN: xml.tests
: xml-error-test ( expected-error xml-string -- ) : xml-error-test ( expected-error xml-string -- )
[ string>xml ] curry swap [ = ] curry must-fail-with ; [ string>xml ] curry swap [ = ] curry must-fail-with ;

12
extra/xmode/tokens/tokens.factor Normal file → Executable file
View File

@ -5,12 +5,12 @@ IN: xmode.tokens
! Based on org.gjt.sp.jedit.syntax.Token ! Based on org.gjt.sp.jedit.syntax.Token
SYMBOL: tokens SYMBOL: tokens
[ <<
{ "COMMENT1" "COMMENT2" "COMMENT3" "COMMENT4" "DIGIT" "FUNCTION" "INVALID" "KEYWORD1" "KEYWORD2" "KEYWORD3" "KEYWORD4" "LABEL" "LITERAL1" "LITERAL2" "LITERAL3" "LITERAL4" "MARKUP" "OPERATOR" "END" "NULL" } [ { "COMMENT1" "COMMENT2" "COMMENT3" "COMMENT4" "DIGIT" "FUNCTION" "INVALID" "KEYWORD1" "KEYWORD2" "KEYWORD3" "KEYWORD4" "LABEL" "LITERAL1" "LITERAL2" "LITERAL3" "LITERAL4" "MARKUP" "OPERATOR" "END" "NULL" } [
create-in dup define-symbol create-in dup define-symbol
dup word-name swap dup word-name swap
] H{ } map>assoc tokens set-global ] H{ } map>assoc tokens set-global
] with-compilation-unit >>
: string>token ( string -- id ) tokens get at ; : string>token ( string -- id ) tokens get at ;