io.launcher.windows tests: Use unique-file instead of temp-file. Fixes
parent
ab399c8ae4
commit
7895e0fcaa
|
@ -1,8 +1,9 @@
|
||||||
USING: accessors arrays assocs calendar continuations
|
USING: accessors arrays assocs calendar
|
||||||
environment eval hashtables io io.directories
|
combinators.short-circuit continuations environment eval
|
||||||
io.encodings.ascii io.encodings.utf8 io.files io.files.temp io.launcher
|
hashtables io io.directories io.encodings.ascii
|
||||||
io.launcher.windows io.pathnames kernel math namespaces parser
|
io.encodings.utf8 io.files io.files.temp io.files.unique
|
||||||
sequences splitting system tools.test combinators.short-circuit ;
|
io.launcher io.launcher.windows io.pathnames kernel math
|
||||||
|
namespaces parser sequences splitting system tools.test ;
|
||||||
IN: io.launcher.windows.tests
|
IN: io.launcher.windows.tests
|
||||||
|
|
||||||
[ "hello world" ] [ { "hello" "world" } join-arguments ] unit-test
|
[ "hello world" ] [ { "hello" "world" } join-arguments ] unit-test
|
||||||
|
@ -76,15 +77,17 @@ IN: io.launcher.windows.tests
|
||||||
: console-vm ( -- path )
|
: console-vm ( -- path )
|
||||||
vm ".exe" ?tail [ ".com" append ] when ;
|
vm ".exe" ?tail [ ".com" append ] when ;
|
||||||
|
|
||||||
|
SYMBOLS: out-path err-path ;
|
||||||
|
|
||||||
[ ] [
|
[ ] [
|
||||||
<process>
|
<process>
|
||||||
console-vm "-run=hello-world" 2array >>command
|
console-vm "-run=hello-world" 2array >>command
|
||||||
"out.txt" temp-file >>stdout
|
"out.txt" unique-file [ out-path set-global ] keep >>stdout
|
||||||
try-process
|
try-process
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
[ "Hello world" ] [
|
[ "Hello world" ] [
|
||||||
"out.txt" temp-file ascii file-lines first
|
out-path get-global ascii file-lines first
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
[ "IN: scratchpad " ] [
|
[ "IN: scratchpad " ] [
|
||||||
|
@ -102,45 +105,45 @@ IN: io.launcher.windows.tests
|
||||||
launcher-test-path [
|
launcher-test-path [
|
||||||
<process>
|
<process>
|
||||||
console-vm "-script" "stderr.factor" 3array >>command
|
console-vm "-script" "stderr.factor" 3array >>command
|
||||||
"out.txt" temp-file >>stdout
|
"out.txt" unique-file [ out-path set-global ] keep >>stdout
|
||||||
"err.txt" temp-file >>stderr
|
"err.txt" unique-file [ err-path set-global ] keep >>stderr
|
||||||
try-process
|
try-process
|
||||||
] with-directory
|
] with-directory
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
[ "output" ] [
|
[ "output" ] [
|
||||||
"out.txt" temp-file ascii file-lines first
|
out-path get-global ascii file-lines first
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
[ "error" ] [
|
[ "error" ] [
|
||||||
"err.txt" temp-file ascii file-lines first
|
err-path get-global ascii file-lines first
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
[ ] [
|
[ ] [
|
||||||
launcher-test-path [
|
launcher-test-path [
|
||||||
<process>
|
<process>
|
||||||
console-vm "-script" "stderr.factor" 3array >>command
|
console-vm "-script" "stderr.factor" 3array >>command
|
||||||
"out.txt" temp-file >>stdout
|
"out.txt" unique-file [ out-path set-global ] keep >>stdout
|
||||||
+stdout+ >>stderr
|
+stdout+ >>stderr
|
||||||
try-process
|
try-process
|
||||||
] with-directory
|
] with-directory
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
[ "outputerror" ] [
|
[ "outputerror" ] [
|
||||||
"out.txt" temp-file ascii file-lines first
|
out-path get-global ascii file-lines first
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
[ "output" ] [
|
[ "output" ] [
|
||||||
launcher-test-path [
|
launcher-test-path [
|
||||||
<process>
|
<process>
|
||||||
console-vm "-script" "stderr.factor" 3array >>command
|
console-vm "-script" "stderr.factor" 3array >>command
|
||||||
"err2.txt" temp-file >>stderr
|
"err2.txt" unique-file [ err-path set-global ] keep >>stderr
|
||||||
utf8 <process-reader> stream-lines first
|
utf8 <process-reader> stream-lines first
|
||||||
] with-directory
|
] with-directory
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
[ "error" ] [
|
[ "error" ] [
|
||||||
"err2.txt" temp-file ascii file-lines first
|
err-path get-global ascii file-lines first
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
|
|
||||||
|
@ -194,26 +197,25 @@ IN: io.launcher.windows.tests
|
||||||
[ ] [
|
[ ] [
|
||||||
<process>
|
<process>
|
||||||
"cmd.exe /c dir" >>command
|
"cmd.exe /c dir" >>command
|
||||||
"dir.txt" temp-file >>stdout
|
"dir.txt" unique-file [ out-path set-global ] keep >>stdout
|
||||||
try-process
|
try-process
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
[ ] [ "dir.txt" temp-file delete-file ] unit-test
|
[ ] [ out-path get-global delete-file ] unit-test
|
||||||
] times
|
] times
|
||||||
|
|
||||||
[ "append-test" temp-file delete-file ] ignore-errors
|
|
||||||
|
|
||||||
{ "Hello appender\r\nÖrjan ågren är åter\r\nHello appender\r\nÖrjan ågren är åter\r\n" } [
|
{ "Hello appender\r\nÖrjan ågren är åter\r\nHello appender\r\nÖrjan ågren är åter\r\n" } [
|
||||||
|
"append-test" unique-file out-path set-global
|
||||||
2 [
|
2 [
|
||||||
launcher-test-path [
|
launcher-test-path [
|
||||||
<process>
|
<process>
|
||||||
console-vm "-script" "append.factor" 3array >>command
|
console-vm "-script" "append.factor" 3array >>command
|
||||||
"append-test" temp-file <appender> >>stdout
|
out-path get-global <appender> >>stdout
|
||||||
try-process
|
try-process
|
||||||
] with-directory
|
] with-directory
|
||||||
] times
|
] times
|
||||||
|
|
||||||
"append-test" temp-file utf8 file-contents
|
out-path get-global utf8 file-contents
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
[ "IN: scratchpad " ] [
|
[ "IN: scratchpad " ] [
|
||||||
|
|
Loading…
Reference in New Issue