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
45 "resource:basis/io/windows/nt/launcher/test" [
47 vm "-script" "stderr.factor" 3array >>command
48 "out.txt" temp-file >>stdout
49 "err.txt" temp-file >>stderr
55 "out.txt" temp-file ascii file-lines first
59 "err.txt" temp-file ascii file-lines first
63 "resource:basis/io/windows/nt/launcher/test" [
65 vm "-script" "stderr.factor" 3array >>command
66 "out.txt" temp-file >>stdout
73 "out.txt" temp-file ascii file-lines first
77 "resource:basis/io/windows/nt/launcher/test" [
79 vm "-script" "stderr.factor" 3array >>command
80 "err2.txt" temp-file >>stderr
81 ascii <process-reader> lines first
86 "err2.txt" temp-file ascii file-lines first
90 "resource:basis/io/windows/nt/launcher/test" [
92 vm "-script" "env.factor" 3array >>command
93 ascii <process-reader> contents
100 "resource:basis/io/windows/nt/launcher/test" [
102 vm "-script" "env.factor" 3array >>command
103 +replace-environment+ >>environment-mode
104 os-envs >>environment
105 ascii <process-reader> contents
106 ] with-directory eval
112 "resource:basis/io/windows/nt/launcher/test" [
114 vm "-script" "env.factor" 3array >>command
115 { { "A" "B" } } >>environment
116 ascii <process-reader> contents
117 ] with-directory eval
123 "resource:basis/io/windows/nt/launcher/test" [
125 vm "-script" "env.factor" 3array >>command
126 { { "USERPROFILE" "XXX" } } >>environment
127 +prepend-environment+ >>environment-mode
128 ascii <process-reader> contents
129 ] with-directory eval
131 "USERPROFILE" swap at "XXX" =
137 "cmd.exe /c dir" >>command
138 "dir.txt" temp-file >>stdout
142 [ ] [ "dir.txt" temp-file delete-file ] unit-test
145 [ "append-test" temp-file delete-file ] ignore-errors
147 [ "Hello appender\r\nHello appender\r\n" ] [
149 "resource:basis/io/windows/nt/launcher/test" [
151 vm "-script" "append.factor" 3array >>command
152 "append-test" temp-file <appender> >>stdout
157 "append-test" temp-file ascii file-contents