1 USING: io.launcher tools.test calendar accessors environment
2 namespaces kernel system arrays io io.files io.encodings.ascii
3 sequences parser assocs hashtables math continuations eval
4 io.files.temp io.directories io.pathnames ;
5 IN: io.launcher.windows.nt.tests
14 [ f ] [ "notepad" get process-running? ] unit-test
16 [ f ] [ "notepad" get process-started? ] unit-test
18 [ ] [ "notepad" [ run-detached ] change ] unit-test
20 [ "notepad" get wait-for-process ] must-fail
22 [ t ] [ "notepad" get killed>> ] unit-test
24 [ f ] [ "notepad" get process-running? ] unit-test
28 vm "-quiet" "-run=hello-world" 3array >>command
29 "out.txt" temp-file >>stdout
34 "out.txt" temp-file ascii file-lines first
39 vm "-run=listener" 2array >>command
44 : launcher-test-path ( -- str )
45 "resource:basis/io/launcher/windows/nt/test" ;
50 vm "-script" "stderr.factor" 3array >>command
51 "out.txt" temp-file >>stdout
52 "err.txt" temp-file >>stderr
58 "out.txt" temp-file ascii file-lines first
62 "err.txt" temp-file ascii file-lines first
68 vm "-script" "stderr.factor" 3array >>command
69 "out.txt" temp-file >>stdout
76 "out.txt" temp-file ascii file-lines first
82 vm "-script" "stderr.factor" 3array >>command
83 "err2.txt" temp-file >>stderr
84 ascii <process-reader> lines first
89 "err2.txt" temp-file ascii file-lines first
95 vm "-script" "env.factor" 3array >>command
96 ascii <process-reader> contents
105 vm "-script" "env.factor" 3array >>command
106 +replace-environment+ >>environment-mode
107 os-envs >>environment
108 ascii <process-reader> contents
109 ] with-directory eval
117 vm "-script" "env.factor" 3array >>command
118 { { "A" "B" } } >>environment
119 ascii <process-reader> contents
120 ] with-directory eval
128 vm "-script" "env.factor" 3array >>command
129 { { "USERPROFILE" "XXX" } } >>environment
130 +prepend-environment+ >>environment-mode
131 ascii <process-reader> contents
132 ] with-directory eval
134 "USERPROFILE" swap at "XXX" =
140 "cmd.exe /c dir" >>command
141 "dir.txt" temp-file >>stdout
145 [ ] [ "dir.txt" temp-file delete-file ] unit-test
148 [ "append-test" temp-file delete-file ] ignore-errors
150 [ "Hello appender\r\nHello appender\r\n" ] [
154 vm "-script" "append.factor" 3array >>command
155 "append-test" temp-file <appender> >>stdout
160 "append-test" temp-file ascii file-contents