Files

34 lines
958 B
Bash
Raw Permalink Normal View History

2020-06-07 16:47:27 -04:00
#!/bin/bash
2021-01-28 18:34:55 -05:00
runErrorTest() {
2021-10-05 14:25:10 -06:00
extractFlag pattern $1.sv
pattern="${flag:-.}"
extractFlag location $1.sv
location="${flag//./\.}"
location="${location:-.}"
2021-10-05 14:25:10 -06:00
2021-01-28 18:34:55 -05:00
runAndCapture $1.sv
2021-10-05 14:25:10 -06:00
assertFalse "regular conversion should have failed" $result
assertNull "regular stdout should be empty" "$stdout"
assertNotNull "regular stderr should not be empty" "$stderr"
assertMatch "regular error message" "$stderr" "$pattern"
runAndCapture -v $1.sv
assertFalse "verbose conversion should have failed" $result
assertNull "verbose stdout should be empty" "$stdout"
assertNotNull "verbose stderr should not be empty" "$stderr"
assertMatch "verbose error message" "$stderr" "$pattern"
assertMatch "verbose location" "$stderr" "$location[^0-9]"
}
2020-06-07 16:47:27 -04:00
addTest() {
test=$1
2021-01-28 18:34:55 -05:00
eval "test_$test() { runErrorTest $test; }"
2020-06-07 16:47:27 -04:00
suite_addTest test_$test
}
2020-07-22 21:35:25 -06:00
source ../lib/functions.sh
2020-06-07 16:47:27 -04:00
source ../lib/discover.sh
. shunit2