1 | #!/usr/bin/env bash |
2 | |
3 | # Compare osh code on stdin (fd 0) and expected oil code on fd 3. |
4 | osh0-oil3() { |
5 | bin/osh --fix "$@" | diff -u /dev/fd/3 - || { echo FAIL; exit 1; } |
6 | } |
7 | |
8 | osh0-oil3 << 'OSH' 2>&1 3<< 'OIL' |
9 | x=1 |
10 | OSH |
11 | x = 1 |
12 | OIL |
13 | |
14 | osh0-oil3 << 'OSH' 2>&1 lossless-invariant 3<< 'OIL' "lossless" |
15 | 1 |
16 | 2 |
17 | 3 |
18 | OSH |
19 | x |
20 | y |
21 | zz |
22 | OIL |
23 |