Unit test fixes
parent
58d6e4c97d
commit
2c23357f25
|
@ -9,7 +9,7 @@ IN: listener.tests
|
|||
<string-reader> stream-read-quot ;
|
||||
|
||||
[ [ ] ] [
|
||||
"USE: temporary hello" parse-interactive
|
||||
"USE: listener.tests hello" parse-interactive
|
||||
] unit-test
|
||||
|
||||
[
|
||||
|
|
|
@ -24,7 +24,7 @@ IN: parser.tests
|
|||
[ "hello world" ]
|
||||
[
|
||||
"IN: parser.tests : hello \"hello world\" ;"
|
||||
eval "USE: temporary hello" eval
|
||||
eval "USE: parser.tests hello" eval
|
||||
] unit-test
|
||||
|
||||
[ ]
|
||||
|
@ -104,12 +104,12 @@ IN: parser.tests
|
|||
|
||||
"IN: parser.tests USING: math prettyprint ; : foo 2 2 + . ; parsing" eval
|
||||
|
||||
[ ] [ "USE: temporary foo" eval ] unit-test
|
||||
[ ] [ "USE: parser.tests foo" eval ] unit-test
|
||||
|
||||
"IN: parser.tests USING: math prettyprint ; : foo 2 2 + . ;" eval
|
||||
|
||||
[ t ] [
|
||||
"USE: temporary \\ foo" eval
|
||||
"USE: parser.tests \\ foo" eval
|
||||
"foo" "parser.tests" lookup eq?
|
||||
] unit-test
|
||||
|
||||
|
|
|
@ -125,18 +125,18 @@ unit-test
|
|||
"IN: prettyprint.tests"
|
||||
"GENERIC: method-layout"
|
||||
""
|
||||
"USING: math temporary ;"
|
||||
"USING: math prettyprint.tests ;"
|
||||
"M: complex method-layout"
|
||||
" \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\""
|
||||
" ;"
|
||||
""
|
||||
"USING: math temporary ;"
|
||||
"USING: math prettyprint.tests ;"
|
||||
"M: fixnum method-layout ;"
|
||||
""
|
||||
"USING: math temporary ;"
|
||||
"USING: math prettyprint.tests ;"
|
||||
"M: integer method-layout ;"
|
||||
""
|
||||
"USING: kernel temporary ;"
|
||||
"USING: kernel prettyprint.tests ;"
|
||||
"M: object method-layout ;"
|
||||
} ;
|
||||
|
||||
|
@ -280,7 +280,7 @@ unit-test
|
|||
"IN: prettyprint.tests"
|
||||
"GENERIC: class-see-layout ( x -- y )"
|
||||
""
|
||||
"USING: temporary ;"
|
||||
"USING: prettyprint.tests ;"
|
||||
"M: class-see-layout class-see-layout ;"
|
||||
} ;
|
||||
|
||||
|
|
|
@ -68,7 +68,10 @@ uses definitions ;
|
|||
: reset-checksums ( -- )
|
||||
source-files get [
|
||||
swap ?resource-path dup exists?
|
||||
[ file-lines swap record-checksum ] [ 2drop ] if
|
||||
[
|
||||
over record-modified
|
||||
file-lines swap record-checksum
|
||||
] [ 2drop ] if
|
||||
] assoc-each ;
|
||||
|
||||
M: pathname where pathname-string 1 2array ;
|
||||
|
|
|
@ -1,42 +1,46 @@
|
|||
IN: fry.tests
|
||||
USING: fry tools.test math prettyprint kernel io arrays
|
||||
sequences ;
|
||||
|
||||
[ [ 3 + ] ] [ 3 '[ , + ] ] unit-test
|
||||
|
||||
[ [ 1 3 + ] ] [ 1 3 '[ , , + ] ] unit-test
|
||||
|
||||
[ [ 1 + ] ] [ 1 [ + ] '[ , @ ] ] unit-test
|
||||
|
||||
[ [ 1 + . ] ] [ 1 [ + ] '[ , @ . ] ] unit-test
|
||||
|
||||
[ [ + - ] ] [ [ + ] [ - ] '[ @ @ ] ] unit-test
|
||||
|
||||
[ [ "a" write "b" print ] ]
|
||||
[ "a" "b" '[ , write , print ] ] unit-test
|
||||
|
||||
[ [ 1 2 + 3 4 - ] ]
|
||||
[ [ + ] [ - ] '[ 1 2 @ 3 4 @ ] ] unit-test
|
||||
|
||||
[ 1/2 ] [
|
||||
1 '[ , _ / ] 2 swap call
|
||||
] unit-test
|
||||
|
||||
[ { { 1 "a" "A" } { 1 "b" "B" } { 1 "c" "C" } } ] [
|
||||
1 '[ , _ _ 3array ]
|
||||
{ "a" "b" "c" } { "A" "B" "C" } rot 2map
|
||||
] unit-test
|
||||
|
||||
[ { { 1 "a" } { 1 "b" } { 1 "c" } } ] [
|
||||
'[ 1 _ 2array ]
|
||||
{ "a" "b" "c" } swap map
|
||||
] unit-test
|
||||
|
||||
[ { { 1 "a" 2 } { 1 "b" 2 } { 1 "c" 2 } } ] [
|
||||
1 2 '[ , _ , 3array ]
|
||||
{ "a" "b" "c" } swap map
|
||||
] unit-test
|
||||
|
||||
: funny-dip '[ @ _ ] call ; inline
|
||||
|
||||
[ "hi" 3 ] [ "h" "i" 3 [ append ] funny-dip ] unit-test
|
||||
IN: fry.tests
|
||||
USING: fry tools.test math prettyprint kernel io arrays
|
||||
sequences ;
|
||||
|
||||
[ [ 3 + ] ] [ 3 '[ , + ] ] unit-test
|
||||
|
||||
[ [ 1 3 + ] ] [ 1 3 '[ , , + ] ] unit-test
|
||||
|
||||
[ [ 1 + ] ] [ 1 [ + ] '[ , @ ] ] unit-test
|
||||
|
||||
[ [ 1 + . ] ] [ 1 [ + ] '[ , @ . ] ] unit-test
|
||||
|
||||
[ [ + - ] ] [ [ + ] [ - ] '[ @ @ ] ] unit-test
|
||||
|
||||
[ [ "a" write "b" print ] ]
|
||||
[ "a" "b" '[ , write , print ] ] unit-test
|
||||
|
||||
[ [ 1 2 + 3 4 - ] ]
|
||||
[ [ + ] [ - ] '[ 1 2 @ 3 4 @ ] ] unit-test
|
||||
|
||||
[ 1/2 ] [
|
||||
1 '[ , _ / ] 2 swap call
|
||||
] unit-test
|
||||
|
||||
[ { { 1 "a" "A" } { 1 "b" "B" } { 1 "c" "C" } } ] [
|
||||
1 '[ , _ _ 3array ]
|
||||
{ "a" "b" "c" } { "A" "B" "C" } rot 2map
|
||||
] unit-test
|
||||
|
||||
[ { { 1 "a" } { 1 "b" } { 1 "c" } } ] [
|
||||
'[ 1 _ 2array ]
|
||||
{ "a" "b" "c" } swap map
|
||||
] unit-test
|
||||
|
||||
[ 1 2 ] [
|
||||
1 2 '[ _ , ] call
|
||||
] unit-test
|
||||
|
||||
[ { { 1 "a" 2 } { 1 "b" 2 } { 1 "c" 2 } } ] [
|
||||
1 2 '[ , _ , 3array ]
|
||||
{ "a" "b" "c" } swap map
|
||||
] unit-test
|
||||
|
||||
: funny-dip '[ @ _ ] call ; inline
|
||||
|
||||
[ "hi" 3 ] [ "h" "i" 3 [ append ] funny-dip ] unit-test
|
||||
|
|
|
@ -1,39 +1,44 @@
|
|||
! Copyright (C) 2008 Slava Pestov, Eduardo Cavazos.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: kernel sequences combinators parser splitting
|
||||
quotations ;
|
||||
IN: fry
|
||||
|
||||
: , "Only valid inside a fry" throw ;
|
||||
: @ "Only valid inside a fry" throw ;
|
||||
: _ "Only valid inside a fry" throw ;
|
||||
|
||||
DEFER: (fry)
|
||||
|
||||
: ((fry)) ( accum quot adder -- result )
|
||||
>r [ ] swap (fry) r>
|
||||
append swap dup empty? [ drop ] [
|
||||
[ swap compose ] curry append
|
||||
] if ; inline
|
||||
|
||||
: (fry) ( accum quot -- result )
|
||||
dup empty? [
|
||||
drop 1quotation
|
||||
] [
|
||||
unclip {
|
||||
{ , [ [ curry ] ((fry)) ] }
|
||||
{ @ [ [ compose ] ((fry)) ] }
|
||||
[ swap >r add r> (fry) ]
|
||||
} case
|
||||
] if ;
|
||||
|
||||
: trivial-fry ( quot -- quot' ) [ ] swap (fry) ;
|
||||
|
||||
: fry ( quot -- quot' )
|
||||
{ _ } last-split1 [
|
||||
>r fry [ [ dip ] curry ] r> trivial-fry [ compose ] compose 3compose
|
||||
] [
|
||||
trivial-fry
|
||||
] if* ;
|
||||
|
||||
: '[ \ ] parse-until fry over push-all ; parsing
|
||||
! Copyright (C) 2008 Slava Pestov, Eduardo Cavazos.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: kernel sequences combinators parser splitting
|
||||
quotations arrays namespaces ;
|
||||
IN: fry
|
||||
|
||||
: , "Only valid inside a fry" throw ;
|
||||
: @ "Only valid inside a fry" throw ;
|
||||
: _ "Only valid inside a fry" throw ;
|
||||
|
||||
DEFER: (fry)
|
||||
|
||||
: ((fry)) ( accum quot adder -- result )
|
||||
>r [ ] swap (fry) r>
|
||||
append swap dup empty? [ drop ] [
|
||||
[ swap compose ] curry append
|
||||
] if ; inline
|
||||
|
||||
: (fry) ( accum quot -- result )
|
||||
dup empty? [
|
||||
drop 1quotation
|
||||
] [
|
||||
unclip {
|
||||
{ , [ [ curry ] ((fry)) ] }
|
||||
{ @ [ [ compose ] ((fry)) ] }
|
||||
[ swap >r add r> (fry) ]
|
||||
} case
|
||||
] if ;
|
||||
|
||||
: trivial-fry ( quot -- quot' ) [ ] swap (fry) ;
|
||||
|
||||
: fry ( quot -- quot' )
|
||||
{ _ } last-split1 [
|
||||
[
|
||||
trivial-fry %
|
||||
[ >r ] %
|
||||
fry %
|
||||
[ [ dip ] curry r> compose ] %
|
||||
] [ ] make
|
||||
] [
|
||||
trivial-fry
|
||||
] if* ;
|
||||
|
||||
: '[ \ ] parse-until fry over push-all ; parsing
|
||||
|
|
|
@ -39,7 +39,7 @@ TUPLE: test-tuple m n ;
|
|||
] unit-test
|
||||
|
||||
[
|
||||
"/responder/temporary/foo?foo=3"
|
||||
"/responder/furnace.tests/foo?foo=3"
|
||||
] [
|
||||
[
|
||||
[ "3" foo ] quot-link
|
||||
|
|
|
@ -16,7 +16,7 @@ IN: help.definitions.tests
|
|||
[ t ] [ "hello" articles get key? ] unit-test
|
||||
[ t ] [ "hello2" articles get key? ] unit-test
|
||||
[ t ] [
|
||||
"hello" "help.definitions" lookup "help" word-prop >boolean
|
||||
"hello" "help.definitions.tests" lookup "help" word-prop >boolean
|
||||
] unit-test
|
||||
|
||||
[ 2 ] [
|
||||
|
@ -29,12 +29,12 @@ IN: help.definitions.tests
|
|||
[ t ] [ "hello" articles get key? ] unit-test
|
||||
[ f ] [ "hello2" articles get key? ] unit-test
|
||||
[ f ] [
|
||||
"hello" "help.definitions" lookup "help" word-prop
|
||||
"hello" "help.definitions.tests" lookup "help" word-prop
|
||||
] unit-test
|
||||
|
||||
[ ] [ "IN: help.definitions.tests USING: help.syntax ; : xxx ; HELP: xxx ;" eval ] unit-test
|
||||
|
||||
[ ] [ "xxx" "help.definitions" lookup help ] unit-test
|
||||
[ ] [ "xxx" "help.definitions.tests" lookup help ] unit-test
|
||||
|
||||
[ ] [ "xxx" "help.definitions" lookup >link synopsis print ] unit-test
|
||||
[ ] [ "xxx" "help.definitions.tests" lookup >link synopsis print ] unit-test
|
||||
] with-file-vocabs
|
||||
|
|
|
@ -4,18 +4,18 @@ USING: tools.test parser vocabs help.syntax namespaces ;
|
|||
[
|
||||
[ "foobar" ] [
|
||||
"IN: help.syntax.tests USE: help.syntax ABOUT: \"foobar\"" eval
|
||||
"help.syntax" vocab vocab-help
|
||||
"help.syntax.tests" vocab vocab-help
|
||||
] unit-test
|
||||
|
||||
[ { "foobar" } ] [
|
||||
"IN: help.syntax.tests USE: help.syntax ABOUT: { \"foobar\" }" eval
|
||||
"help.syntax" vocab vocab-help
|
||||
"help.syntax.tests" vocab vocab-help
|
||||
] unit-test
|
||||
|
||||
SYMBOL: xyz
|
||||
|
||||
[ xyz ] [
|
||||
"IN: help.syntax.tests USE: help.syntax ABOUT: xyz" eval
|
||||
"help.syntax" vocab vocab-help
|
||||
"help.syntax.tests" vocab vocab-help
|
||||
] unit-test
|
||||
] with-file-vocabs
|
||||
|
|
|
@ -82,10 +82,10 @@ DEFER: <% delimiter
|
|||
templating-vocab use+
|
||||
! so that reload works properly
|
||||
dup source-file file set
|
||||
dup ?resource-path file-contents
|
||||
?resource-path file-contents
|
||||
[ eval-template ] [ html-error. drop ] recover
|
||||
] with-file-vocabs
|
||||
] assert-depth drop ;
|
||||
] curry assert-depth ;
|
||||
|
||||
: run-relative-template-file ( filename -- )
|
||||
file get source-file-path parent-directory
|
||||
|
|
|
@ -6,7 +6,7 @@ GENERIC: foo
|
|||
|
||||
M: integer foo + ;
|
||||
|
||||
"resource:extra/tools/test/foo.factor" run-file
|
||||
"resource:extra/tools/crossref/test/foo.factor" run-file
|
||||
|
||||
[ t ] [ integer \ foo method method-word \ + usage member? ] unit-test
|
||||
[ t ] [ \ foo usage [ pathname? ] contains? ] unit-test
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
USE: temporary
|
||||
USE: tools.crossref.tests
|
||||
USE: kernel
|
||||
|
||||
1 2 foo drop
|
Loading…
Reference in New Issue