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

Zachary Snow committed
3
runErrorTest() {
4 5
    extractFlag pattern $1.sv
    pattern="${flag:-.}"
6 7 8
    extractFlag location $1.sv
    location="${flag//./\.}"
    location="${location:-.}"
9

Zachary Snow committed
10
    runAndCapture $1.sv
11 12 13 14 15 16 17 18 19 20
    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"
21
    assertMatch "verbose location" "$stderr" "$location[^0-9]"
22 23
}

Zachary Snow committed
24 25
addTest() {
    test=$1
Zachary Snow committed
26
    eval "test_$test() { runErrorTest $test; }"
Zachary Snow committed
27 28 29
    suite_addTest test_$test
}

30
source ../lib/functions.sh
Zachary Snow committed
31 32 33
source ../lib/discover.sh

. shunit2