blob: eccc3382801f7c87864e06d62b60611e7adbe833 [file] [log] [blame]
Frederic Lepiedae55c182017-04-14 08:31:34 +02001# utility functions for shell tests
2
3assert_true() {
4 if ! $1; then
5 echo "FAIL: command '$1' failed with exit code $?" >&2
6 exit 1
7 fi
8}
9
10
11assert_eq() {
12 if [ "$1" != "$2" ]; then
13 echo "FAIL: expected: '$2' actual: '$1'" >&2
14 exit 1
15 fi
16}
17
18assert_in() {
19 if ! echo "$2" | grep -q "$1"; then
20 echo "FAIL: '$1' not found in:" >&2
21 echo "$2" >&2
22 exit 1
23 fi
24}
25