2020-06-07 22:47:27 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
2021-01-29 00:34:55 +01:00
|
|
|
runErrorTest() {
|
|
|
|
|
runAndCapture $1.sv
|
|
|
|
|
assertFalse "conversion should have failed" $result
|
|
|
|
|
assertNull "stdout should be empty" "$stdout"
|
2021-01-20 23:34:18 +01:00
|
|
|
assertNotNull "stderr should not be empty" "$stderr"
|
2021-01-29 00:34:55 +01:00
|
|
|
line=`head -n1 $1.sv`
|
2021-01-20 23:34:18 +01:00
|
|
|
if [[ "$line" =~ \/\/\ pattern:\ .* ]]; then
|
|
|
|
|
pattern=${line:12}
|
|
|
|
|
if [[ ! "$stderr" =~ $pattern ]]; then
|
|
|
|
|
fail "error message doesn't match\nexpected: $pattern\nactual: $stderr"
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-07 22:47:27 +02:00
|
|
|
addTest() {
|
|
|
|
|
test=$1
|
2021-01-29 00:34:55 +01:00
|
|
|
eval "test_$test() { runErrorTest $test; }"
|
2020-06-07 22:47:27 +02:00
|
|
|
suite_addTest test_$test
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-23 05:35:25 +02:00
|
|
|
source ../lib/functions.sh
|
2020-06-07 22:47:27 +02:00
|
|
|
source ../lib/discover.sh
|
|
|
|
|
|
|
|
|
|
. shunit2
|