Merge branch 'master' of git://factorcode.org/git/factor
commit
afa006c026
|
@ -36,15 +36,15 @@ MIMIC: bee goodbye hello
|
||||||
[ { t 1 0 } ] [ 1 0 <hello> bing ] unit-test
|
[ { t 1 0 } ] [ 1 0 <hello> bing ] unit-test
|
||||||
[ 1 ] [ 1 0 <hello> f <goodbye> foo ] unit-test
|
[ 1 ] [ 1 0 <hello> f <goodbye> foo ] unit-test
|
||||||
[ { t 1 0 } ] [ 1 0 <hello> f <goodbye> bar ] unit-test
|
[ { t 1 0 } ] [ 1 0 <hello> f <goodbye> bar ] unit-test
|
||||||
[ { f 1 0 } ] [ f 1 0 <hello> <goodbye> bing ] unit-test
|
! [ { f 1 0 } ] [ f 1 0 <hello> <goodbye> bing ] unit-test
|
||||||
[ 3 ] [ 1 0 <hello> 2 whoa ] unit-test
|
[ 3 ] [ 1 0 <hello> 2 whoa ] unit-test
|
||||||
[ 3 ] [ 1 0 <hello> f <goodbye> 2 whoa ] unit-test
|
[ 3 ] [ 1 0 <hello> f <goodbye> 2 whoa ] unit-test
|
||||||
|
|
||||||
[ ] [ 10 [ "USE: delegate IN: delegate.tests CONSULT: baz goodbye goodbye-these ;" eval ] times ] unit-test
|
[ ] [ 10 [ "USE: delegate IN: delegate.tests CONSULT: baz goodbye goodbye-these ;" eval ] times ] unit-test
|
||||||
[ V{ goodbye } ] [ baz protocol-users ] unit-test
|
[ V{ goodbye } ] [ baz protocol-users ] unit-test
|
||||||
|
|
||||||
[ "USING: delegate ;\nIN: delegate.tests\nPROTOCOL: baz foo bar { whoa 1 } ;\n" ]
|
! [ "USING: delegate ;\nIN: delegate.tests\nPROTOCOL: baz foo bar { whoa 1 } ;\n" ]
|
||||||
[ [ baz see ] with-string-writer ] unit-test
|
! [ [ baz see ] with-string-writer ] unit-test
|
||||||
|
|
||||||
! [ ] [ [ baz forget ] with-compilation-unit ] unit-test
|
! [ ] [ [ baz forget ] with-compilation-unit ] unit-test
|
||||||
! [ f ] [ goodbye baz method ] unit-test
|
! [ f ] [ goodbye baz method ] unit-test
|
||||||
|
|
|
@ -31,7 +31,10 @@ USE: unix
|
||||||
: redirect-fd ( oldfd fd -- )
|
: redirect-fd ( oldfd fd -- )
|
||||||
2dup = [ 2drop ] [ dupd dup2 io-error close ] if ;
|
2dup = [ 2drop ] [ dupd dup2 io-error close ] if ;
|
||||||
|
|
||||||
: reset-fd ( fd -- ) F_SETFL 0 fcntl io-error ;
|
: reset-fd ( fd -- )
|
||||||
|
#! We drop the error code because on *BSD, fcntl of
|
||||||
|
#! /dev/null fails.
|
||||||
|
F_SETFL 0 fcntl drop ;
|
||||||
|
|
||||||
: redirect-inherit ( obj mode fd -- )
|
: redirect-inherit ( obj mode fd -- )
|
||||||
2nip reset-fd ;
|
2nip reset-fd ;
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
IN: io.windows.launcher.tests
|
||||||
|
USING: tools.test io.windows.launcher ;
|
||||||
|
|
||||||
|
[ "hello world" ] [ { "hello" "world" } join-arguments ] unit-test
|
||||||
|
|
||||||
|
[ "bob \"mac arthur\"" ] [ { "bob" "mac arthur" } join-arguments ] unit-test
|
||||||
|
|
||||||
|
[ "bob mac\\\\arthur" ] [ { "bob" "mac\\\\arthur" } join-arguments ] unit-test
|
||||||
|
|
||||||
|
[ "bob \"mac arthur\\\\\"" ] [ { "bob" "mac arthur\\" } join-arguments ] unit-test
|
|
@ -44,8 +44,21 @@ TUPLE: CreateProcess-args
|
||||||
lpProcessInformation>>
|
lpProcessInformation>>
|
||||||
} get-slots CreateProcess win32-error=0/f ;
|
} get-slots CreateProcess win32-error=0/f ;
|
||||||
|
|
||||||
|
: count-trailing-backslashes ( str n -- str n )
|
||||||
|
>r "\\" ?tail [
|
||||||
|
r> 1+ count-trailing-backslashes
|
||||||
|
] [
|
||||||
|
r>
|
||||||
|
] if ;
|
||||||
|
|
||||||
|
: fix-trailing-backslashes ( str -- str' )
|
||||||
|
0 count-trailing-backslashes
|
||||||
|
2 * CHAR: \\ <repetition> append ;
|
||||||
|
|
||||||
: escape-argument ( str -- newstr )
|
: escape-argument ( str -- newstr )
|
||||||
CHAR: \s over member? [ "\"" swap "\"" 3append ] when ;
|
CHAR: \s over member? [
|
||||||
|
"\"" swap fix-trailing-backslashes "\"" 3append
|
||||||
|
] when ;
|
||||||
|
|
||||||
: join-arguments ( args -- cmd-line )
|
: join-arguments ( args -- cmd-line )
|
||||||
[ escape-argument ] map " " join ;
|
[ escape-argument ] map " " join ;
|
||||||
|
|
|
@ -23,7 +23,7 @@ namespaces continuations layouts ;
|
||||||
[ ] [ "sudoku" shake-and-bake ] unit-test
|
[ ] [ "sudoku" shake-and-bake ] unit-test
|
||||||
|
|
||||||
[ t ] [
|
[ t ] [
|
||||||
1500000 small-enough?
|
cell 8 = 30 15 ? 100000 * small-enough?
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
[ ] [ "hello-ui" shake-and-bake ] unit-test
|
[ ] [ "hello-ui" shake-and-bake ] unit-test
|
||||||
|
@ -34,13 +34,13 @@ namespaces continuations layouts ;
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
[ t ] [
|
[ t ] [
|
||||||
2000000 small-enough?
|
cell 8 = 40 20 ? 100000 * small-enough?
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
[ ] [ "bunny" shake-and-bake ] unit-test
|
[ ] [ "bunny" shake-and-bake ] unit-test
|
||||||
|
|
||||||
[ t ] [
|
[ t ] [
|
||||||
3000000 small-enough?
|
cell 8 = 50 30 ? 100000 * small-enough?
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
[ ] [
|
[ ] [
|
||||||
|
|
Loading…
Reference in New Issue