1 | ## our_shell: ysh
|
2 | ## oils_failures_allowed: 1
|
3 |
|
4 | # Hm can we do this entirely in user code, not as a builtin?
|
5 |
|
6 | #### Describe Prototype
|
7 |
|
8 | source --builtin testing.ysh
|
9 |
|
10 | proc p {
|
11 | echo STDOUT
|
12 | echo STDERR >& 2
|
13 | return 42
|
14 | }
|
15 |
|
16 | describe p {
|
17 | # each case changes to a clean directory?
|
18 | #
|
19 | # and each one is numbered?
|
20 |
|
21 | it 'prints to stdout and stderr' {
|
22 | try {
|
23 | p > out 2>& err
|
24 | }
|
25 | assert (_status === 42)
|
26 |
|
27 | cat out
|
28 | cat err
|
29 |
|
30 | # Oh man the here docs are still useful here because of 'diff' interface
|
31 | # Multiline strings don't quite do it
|
32 |
|
33 | diff out - <<< '''
|
34 | STDOUT
|
35 | '''
|
36 |
|
37 | diff err - <<< '''
|
38 | STDERR
|
39 | '''
|
40 | }
|
41 | }
|
42 |
|
43 | ## STDOUT:
|
44 | TODO
|
45 | ## END
|