diff options
author | Luca Bruno <lucabru@src.gnome.org> | 2011-06-04 11:16:44 +0200 |
---|---|---|
committer | Luca Bruno <lucabru@src.gnome.org> | 2011-06-04 11:19:40 +0200 |
commit | a0b44156250a6b884edd0a48ef3d4a10c762d811 (patch) | |
tree | a0c46b4a94658afd50c9a41b6a61eaa66e8b14f5 | |
parent | 5e73f32a61ba25754c95bb3670194c57cc1e86ab (diff) | |
download | vala-tests.tar.gz |
tests: Support negative test casestests
Fixes bug 630597.
-rw-r--r-- | tests/Makefile.am | 2 | ||||
-rw-r--r-- | tests/asynchronous/bug646945.test (renamed from tests/asynchronous/bug646945.vala) | 9 | ||||
-rwxr-xr-x | tests/testrunner.sh | 40 |
3 files changed, 37 insertions, 14 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index bec9a3f30..83fa746f5 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -108,7 +108,7 @@ TESTS = \ asynchronous/bug620740.vala \ asynchronous/bug639591.vala \ asynchronous/bug641182.vala \ - asynchronous/bug646945.vala \ + asynchronous/bug646945.test \ asynchronous/closures.vala \ dbus/basic-types.test \ dbus/arrays.test \ diff --git a/tests/asynchronous/bug646945.vala b/tests/asynchronous/bug646945.test index ad17d486b..2708b65c0 100644 --- a/tests/asynchronous/bug646945.vala +++ b/tests/asynchronous/bug646945.test @@ -1,3 +1,12 @@ + +Negative: negative + +async void foo () { bar.callback (); } + +async void bar () { foo.callback (); } + +Program: positive + class Foo : Object { public virtual async void method1 () { } } diff --git a/tests/testrunner.sh b/tests/testrunner.sh index 7e528593d..7b8ba48f1 100755 --- a/tests/testrunner.sh +++ b/tests/testrunner.sh @@ -54,6 +54,12 @@ function sourceheader() { SOURCEFILES="$SOURCEFILES $SOURCEFILE" echo " case \"/$testpath\": $ns.main (); break;" >> main.vala echo "namespace $ns {" > $SOURCEFILE + elif [ "$1" = "Negative:" ]; then + testpath=${testfile/.test/}/$2 + ns=${testpath//\//.} + ns=${ns//-/_} + SOURCEFILE=$ns.vala + NEGATIVETEST=1 elif [ $GIRTEST -eq 1 ]; then if [ "$1" = "Input:" ]; then testpath=${testfile/.test/} @@ -91,6 +97,9 @@ function sourceend() { echo "</repository>" >> $SOURCEFILE fi echo "$VAPIGEN $VAPIGENFLAGS --library $ns $ns.gir && tail -n +5 $ns.vapi|head -n -1|sed '/^$/d'|sed 's/^\s*//'|cmp --quiet $ns.vapi.ref" > check + elif [ $NEGATIVETEST -eq 1 ]; then + echo "! $VALAC --vapidir $vapidir --fatal-warnings $([ -z "$PACKAGES" ] || echo $PACKAGES | xargs -n 1 echo -n " --pkg") -C $SOURCEFILE" > check + addtocheck else echo "}" >> $SOURCEFILE echo "./test$EXEEXT /$testpath" > check @@ -98,6 +107,21 @@ function sourceend() { fi } +function addtocheck() { + cat prepare check > $ns.check + cat << EOF >> checkall +echo -n -e " /$testpath: \033[72G" +((all++)) +if bash $ns.check &>log; then + echo -e "\033[0;32mOK\033[m" +else + ((fail++)) + echo -e "\033[0;31mFAIL\033[m" + cat log +fi +EOF +} + testdir=_test rm -rf $testdir mkdir $testdir @@ -140,6 +164,7 @@ for testfile in "$@"; do PART=0 INHEADER=1 GIRTEST=0 + NEGATIVETEST=0 testpath= while IFS="" read -r line; do if [ $PART -eq 0 ]; then @@ -160,6 +185,7 @@ for testfile in "$@"; do sourceend PART=$(($PART + 1)) INHEADER=1 + NEGATIVETEST=0 testpath= sourceheader $line else @@ -177,19 +203,7 @@ for testfile in "$@"; do sourceend ;; esac - - cat prepare check > $ns.check - cat << EOF >> checkall -echo -n -e " /$testpath: \033[72G" -((all++)) -if bash $ns.check &>log; then - echo -e "\033[0;32mOK\033[m" -else - ((fail++)) - echo -e "\033[0;31mFAIL\033[m" - cat log -fi -EOF + addtocheck done cat << "EOF" >> checkall |