0041-dc.sh - sbase - suckless unix tools
HTML git clone git://git.suckless.org/sbase
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
0041-dc.sh (1658B)
---
1 #!/bin/sh
2
3 tmp=$$.tmp
4
5 trap 'rm -f $tmp' EXIT
6 trap 'exit $?' HUP INT TERM
7
8 cat <<'EOF' > $tmp
9 ../dc: stack empty
10 ../dc: Q command argument exceeded string execution depth
11 ../dc: Q command requires a number >= 0
12 ../dc: Q command argument exceeded string execution depth
13 test 1:
14 test 2:
15 test 3:
16 test 4:
17 test 5:
18 99
19 test 6:
20 1
21 4
22 test 7:
23 in-macro
24 after-macro
25 test 8:
26 inner
27 after-all
28 test 9:
29 before
30 after
31 test 10:
32 not-equal
33 continued
34 test 11:
35 equal
36 continued
37 test 12:
38 3
39 2
40 done
41 test 12a:
42 3
43 done
44 test 13:
45 0
46 1
47 2
48 done
49 test 13a:
50 0
51 done
52 test 14:
53 deep
54 outer
55 final
56 test 15:
57 42
58 test 16:
59 done
60 test 17:
61 first
62 last
63 test 18:
64 before
65 test 19:
66 before-q
67 test 20:
68 equal
69 EOF
70
71 ($EXEC ../dc <<'EOF'
72 [test 1:]pc Q
73 [test 2:]pc 1Q
74 [test 3:]pc _1Q
75 [test 4:]pc [100Q]x
76 [test 5:]pc 99 [1Q]x p
77 [test 6:]pc [[1p q 2p]x 3p]x 4p
78 [test 7:]pc [[in-macro]p 1Q [not-printed]p]x [after-macro]p
79 [test 8:]pc [[[inner]p 2Q [not1]p]x [not2]p]x [after-all]p
80 [test 9:]pc [before]p 0Q [after]p
81 [test 10:]pc [[equal-quit]p q]sa 5 3 =a [not-equal]p [continued]p
82 [test 11:]pc [[equal-quit]p q]sa 5 5 !=a [equal]p [continued]p
83 [test 12:]pc 3[[p 1- d 2 !>b 1Q]x]sb lbx [done]p
84 [test 12a:]pc 3[[p 1- d 2 >b 1Q]x]sb lbx [done]p
85 [test 13:]pc 0[[p 1+ d 2 !<b 1Q]x]sb lbx [done]p
86 [test 13a:]pc 0[[p 1+ d 2 <b 1Q]x]sb lbx [done]p
87 [test 14:]pc [[[[deep]p 2Q [x]p]x [y]p]x [outer]p]x [final]p
88 [test 15:]pc [[42 q]x [x]p]x p
89 [test 16:]pc [[1Q [not]p]x [done]p]x
90 [test 17:]pc [[[first]p q q q]x [x]p]x [last]p
91 [test 18:]pc [before]p q [after]p
92 EOF
93
94 $EXEC ../dc <<'EOF'
95 [test 19:]pc [[before-q]p q [after-q]p]x [never]p
96 EOF
97
98 $EXEC ../dc <<'EOF'
99 [test 20:]pc [[equal]p q]sa 5 5 =a [not-printed]p
100 EOF
101 ) 2>&1 | diff -u - $tmp