Debian Codegraph @

test/win-noconsole-stdio.scm

raw
1 ;;
2 ;; This manually test AllocConsole() opeartion of gosh-noconsole.exe
3 ;; on MinGW. This can't be automated easily, so it's not run by
4 ;; make check.
5 ;;
6
7 (cond-expand
8 [(not gauche.os.windows)
9 (exit 1 "This script needs to be run on MinGW version of gosh-noconsole.")]
10 [else])
11
12 (use gauche.process)
13
14 ;; stdio test
15
16 (print "1+2+3=" (+ 1 2 3))
17 (print "HIT ENTER KEY!")
18 (read-line)
19 (display "4+5+6=" (current-error-port))
20 (display (+ 4 5 6) (current-error-port))
21 (newline (current-error-port))
22 (display "HIT ENTER KEY!" (current-error-port))
23 (read-line)
24
25 ;; run-process input test
26
27 (let* ((p (run-process "more.com" :input :pipe))
28 (out (process-input p)))
29 (display (iota 511) out)
30 (newline out)
31 (close-output-port out)
32 (process-wait p))
33 (print "HIT ENTER KEY!")
34 (read-line)
35
36 ;; run-process output test
37
38 (let* ((p (run-process '(echo "12345\nabcde") :output :pipe))
39 (in (process-output p)))
40 (display (read-line in))
41 (newline)
42 (display (read-line in))
43 (newline)
44 (close-input-port in)
45 (process-wait p))
46 (print "HIT ENTER KEY!")
47 (read-line)
48
49 ;; sys-system test
50
51 (sys-system "date /t")
52 (sys-system "time /t")
53 (print "HIT ENTER KEY!")
54 (read-line)