run.sh 639 Bytes
Newer Older
Zachary Snow committed
1 2
#!/bin/bash

Zachary Snow committed
3 4 5 6
runErrorTest() {
    runAndCapture $1.sv
    assertFalse "conversion should have failed" $result
    assertNull "stdout should be empty" "$stdout"
7
    assertNotNull "stderr should not be empty" "$stderr"
Zachary Snow committed
8
    line=`head -n1 $1.sv`
9 10 11 12 13 14 15 16
    if [[ "$line" =~ \/\/\ pattern:\ .* ]]; then
        pattern=${line:12}
        if [[ ! "$stderr" =~ $pattern ]]; then
            fail "error message doesn't match\nexpected: $pattern\nactual: $stderr"
        fi
    fi
}

Zachary Snow committed
17 18
addTest() {
    test=$1
Zachary Snow committed
19
    eval "test_$test() { runErrorTest $test; }"
Zachary Snow committed
20 21 22
    suite_addTest test_$test
}

23
source ../lib/functions.sh
Zachary Snow committed
24 25 26
source ../lib/discover.sh

. shunit2