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