-
Notifications
You must be signed in to change notification settings - Fork 13
/
capture.t
39 lines (29 loc) · 870 Bytes
/
capture.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
(use test-by-example)
(example-test (runtime '(capture)) #<<.
> (capture-out (fn () (pr "xyz")))
((prints "xyz"))
> (capture-errout (fn () (ero "foo")))
((errout "\"foo\" \n"))
> (capture-val (fn () 123))
((val 123))
> (capture-val (fn () (err "foo")))
((err "foo"))
> (capture-val-out (fn ()
(pr "xyz")
(ero 'ignored)
123))
((val 123) (prints "xyz"))
> (capture-val-out-errout (fn () 123))
((val 123))
> (capture-val-out-errout (fn ()
(pr "xyz")
(ero 'foo)
123))
((val 123) (prints "xyz") (errout "foo \n"))
> (capture-val-out-errout (fn ()
(pr "abc")
(ero 'def)
(err "foo")))
((err "foo") (prints "abc") (errout "def \n"))
.
)