forked from ekalinin/github-markdown-toc
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_helper.bash
More file actions
44 lines (39 loc) · 732 Bytes
/
Copy pathtest_helper.bash
File metadata and controls
44 lines (39 loc) · 732 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
#!/usr/bin/env bash
assert_equal() {
if [ "$1" != "$2" ]; then
echo "expected: $1"
echo "actual: $2"
return 1
fi
}
assert_range() {
if [ $1 -lt $2 ]; then
echo "expected: $1"
echo "greater than: $2"
return 1
fi
if [ $1 -gt $3 ]; then
echo "expected: $1"
echo "less than: $3"
return 1
fi
}
assert_output() {
assert_equal "$1" "$output"
}
assert_success() {
if [ "$status" -ne 0 ]; then
echo "command failed with exit status $status"
return 1
elif [ "$#" -gt 0 ]; then
assert_output "$1"
fi
}
assert_fail() {
if [ "$status" -eq 0 ]; then
echo "command successed, but should fail"
return 1
elif [ "$#" -gt 0 ]; then
assert_output "$1"
fi
}