-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.sh
More file actions
executable file
·50 lines (43 loc) · 981 Bytes
/
test.sh
File metadata and controls
executable file
·50 lines (43 loc) · 981 Bytes
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
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
#
# Run some tests on rerun.
#
# Helper to check output from macros
check() {
local cmd=$1; shift
echo -n '***' $cmd 'result: ' >&2
while read; do
(($#==0)) && { echo "failed (extra output)." >&2; return 1; }
(($1==$REPLY)) || { echo "failed ($1 != $REPLY)." >&2; return 1; }
shift
done <<<"$($cmd)"
(($#==0)) || { echo "failed (more output expected)." >&2; return 1; }
echo "okay." >&2
}
# Establish some history
set -o history
echo 1
echo 2
echo 3
echo 4
echo 5
set +o history
# Bring in rerun
PS1=" " # Fake out rerun into thinking we're interactive
source rerun.sh
# Creation from list
t=create_from_list
rerun create $t 1 4 3 2 5
check $t 1 4 3 2 5
# Creation from range
t=create_from_range
rerun create $t 1-5
check $t 1 2 3 4 5
# Creation from start:count
t=create_from_start_and_count
rerun create $t 1:5
check $t 1 2 3 4 5
# Creation from include spec
t=create_from_include_spec
rerun create $t 1.--.
check $t 1 2 5