blob: ff684cc6d6b2556ae789583423287a63574ac853 (
plain) (
blame)
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
|
#!/bin/sh
set -u
. tests/lib.sh
export XDG_DATA_HOME="$PWD/tests/test-profiles/signals-$(uuid)"
test_status_is_zero_when_command_is_successful() {
testing 'status is 0 when command is successful'
N="$LINENO"
printf 'a\n' | ./src/remembering -pp1 -- head -n1 1>/dev/null 2>/dev/null
STATUS=$?
assert_status 0
printf '' | ./src/remembering -pp2 -- true 1>/dev/null 2>/dev/null
STATUS=$?
assert_status 0
seq 9 | ./src/remembering -pp3 -- grep 7 1>/dev/null 2>/dev/null
STATUS=$?
assert_status 0
test_ok
}
test_status_is_forwarded_from_command() {
testing 'status is forwarded from command'
N="$LINENO"
for status in $(seq 1 125); do
printf '' | ./src/remembering -pp4 -- sh -c "exit $status" 1>/dev/null 2>/dev/null
STATUS=$?
assert_status "$status"
done
test_ok
}
test_status_is_zero_when_command_is_successful
test_status_is_forwarded_from_command
|