]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
tests: Support tests with invalid code
authorJürg Billeter <j@bitron.ch>
Sat, 25 Jun 2016 13:36:10 +0000 (15:36 +0200)
committerJürg Billeter <j@bitron.ch>
Sat, 25 Jun 2016 13:36:53 +0000 (15:36 +0200)
tests/testrunner.sh

index a96b5ac5d343830d24c04123ec19b8e6039e389a..0513905aba9d90775bfb1c03339f7d0fac5558a9 100755 (executable)
@@ -43,6 +43,13 @@ function testheader() {
        if [ "$1" = "Packages:" ]; then
                shift
                PACKAGES="$PACKAGES $@"
+       elif [ "$*" = "Invalid Code" ]; then
+               INVALIDCODE=1
+               INHEADER=0
+               testpath=${testfile/.test/}
+               ns=${testpath//\//.}
+               ns=${ns//-/_}
+               SOURCEFILE=$ns.vala
        elif [ "$1" = "D-Bus" ]; then
                echo 'eval `dbus-launch --sh-syntax`' >> prepare
                echo 'trap "kill $DBUS_SESSION_BUS_PID" INT TERM EXIT' >> prepare
@@ -91,7 +98,9 @@ EOF
 
 function sourceend() {
        if [ -n "$testpath" ]; then
-               if [ $GIRTEST -eq 1 ]; then
+               if [ $INVALIDCODE -eq 1 ]; then
+                       echo "! $VALAC --vapidir $vapidir -C $SOURCEFILE" > check
+               elif [ $GIRTEST -eq 1 ]; then
                        if [ $PART -eq 1 ]; then
                                echo "  </namespace>" >> $SOURCEFILE
                                echo "</repository>" >> $SOURCEFILE
@@ -145,6 +154,7 @@ for testfile in "$@"; do
        *.test)
                PART=0
                INHEADER=1
+               INVALIDCODE=0
                GIRTEST=0
                testpath=
                while IFS="" read -r line; do