source: project/release/4/pty/trunk/pty-test.scm @ 20027

Last change on this file since 20027 was 20027, checked in by felix winkelmann, 11 years ago

tagged them eggs of da foof

File size: 2.0 KB
Line 
1;;;; pty-test.scm
2
3(use testbase testbase-output-human)
4(use pty)
5(use utils miscmacros)
6
7(define-for-syntax test::timing #f)
8(define-for-syntax test::filtering #f)
9(define-for-syntax test::selecting #f)
10(define-for-syntax test::limiting #f)
11
12#;(define (kill-it! pid)
13  (process-signal pid)
14  (process-wait pid #t) )
15 
16#;(char-name 'eot (integer->char 4))
17
18(define-test pty-error-test "Pty procedure error"
19  (expect-exception "Invalid Procedure"
20    (property exn
21      (message "invalid procedure")
22      (arguments '(foo))
23      (location 'call-with-pty-process-io))
24    (call-with-pty-process-io "foo" 'foo))
25)
26
27;** PROBLEM **
28;Port out appears echoed to in
29;Repeat runs have caused system crash on MacOS 10.4
30;Repeat runs have caused process pend on MacOS 10.4
31;Must be using 'bc' wrong
32#;(define-test pty-bc-test "Pty using 'bc'"
33  (expect-eqv "PI"
34    3.1415926532
35    (call-with-pty-process-io '("/usr/bin/bc" "-lqi")
36      (lambda (in out pid)
37        ;operation
38        (display "scale=10; 4*a(1)" out) (newline out)
39        ;result
40        (begin0
41          (read in)
42          #;(let loop ([lines '()])
43            (if (char-ready? in)
44              (loop (cons (read-line in) lines))
45              (reverse! lines)))
46          ;clean termination
47          (display "quit" out) (newline out) ) )
48      "BC"))
49  (expect-success (gc #t))
50)
51
52(define-test pty-units-test "Pty using 'units'"
53  (expect-equal "Meters/Feet"
54    '("meters" "feet" "\t* 3.2808399" "\t/ 0.3048")
55    (call-with-pty-process-io '("/usr/bin/units" "-q")
56      (lambda (in out pid)
57        ;operation
58        (display "meters" out) (newline out)
59        (display "feet" out) (newline out)
60        ;result
61        (begin0
62          (list (read-line in) (read-line in) (read-line in) (read-line in))
63          ;clean termination - send EOT
64          (display (integer->char 4) out) ) )
65      "Units"))
66  (expect-success (gc #t))
67)
68
69(test::for-each (cut test::styler-set! <> test::output-style-human))
70(run-test "Pty Test")
Note: See TracBrowser for help on using the repository browser.