[vala-tests] Add bug 627090 test case



commit 9c0359b8b2f6cbcd8c6ea36af4bddedba14191fa
Author: Marc-André Lureau <marcandre lureau gmail com>
Date:   Tue Aug 17 02:43:38 2010 +0200

    Add bug 627090 test case

 src/test-common.sh     |    5 +++--
 tests/bugs/627090.test |    3 +++
 tests/bugs/627090.vala |   23 +++++++++++++++++++++++
 3 files changed, 29 insertions(+), 2 deletions(-)
---
diff --git a/src/test-common.sh b/src/test-common.sh
index 6cd129b..fc70820 100644
--- a/src/test-common.sh
+++ b/src/test-common.sh
@@ -84,6 +84,7 @@ function _test_setup() {
     else
         TESTV="${TESTV:-0}"
     fi
+    TESTTIMEOUT="${TESTTIMEOUT:-10s}"
     [ "$TESTNAME" -gt 0 2>/dev/null ] && BUGID="${BUGID:-$TESTNAME}"
     [ -n "$BUGID" ] && BUGZILLA="http://bugzilla.gnome.org/show_bug.cgi?id=$BUGID";
 
@@ -149,7 +150,7 @@ function _test_compile {
     fi
     compile="$VALAC $VALAFLAGS $PACKAGES -o $TESTNAME $TESTSRC"
     echo "$compile"
-    sh -c "$compile" >$STDOUT 2>$STDERR
+    timeout ${TESTTIMEOUT} sh -c "G_DEBUG=fatal_warnings $compile" >$STDOUT 2>$STDERR
     exitval="$?"
     _test_compile_check
 }
@@ -183,7 +184,7 @@ function _test_run {
     elif [ -z "$INTERACT" -a "x$TESTRUN" = "xinteract" ]; then
         echo "*** WARNING: This vala test is interactive and will not be run (try --interact) ***"
     else
-        sh -c "$TESTENV $VALGRIND ./$TESTNAME $TESTARGS $@" >$STDOUT 2>$STDERR
+        timeout ${TESTTIMEOUT} sh -c "$TESTENV $VALGRIND ./$TESTNAME $TESTARGS $@" >$STDOUT 2>$STDERR
         exitval="$?"
         _test_run_check
     fi
diff --git a/tests/bugs/627090.test b/tests/bugs/627090.test
new file mode 100755
index 0000000..8c65445
--- /dev/null
+++ b/tests/bugs/627090.test
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+. test-common.sh
diff --git a/tests/bugs/627090.vala b/tests/bugs/627090.vala
new file mode 100644
index 0000000..2f2b8d1
--- /dev/null
+++ b/tests/bugs/627090.vala
@@ -0,0 +1,23 @@
+public class Foo : GLib.Object {
+	public string bar_str {
+		owned get {
+			try {
+				return method_which_throws_an_error ();
+			} catch (GLib.Error e) {
+				GLib.error ("Error: %s", e.message);
+			}
+		}
+	}
+}
+
+private string method_which_throws_an_error () throws GLib.Error {
+	return "Hello";
+}
+
+private static int main (string[] args) {
+	var foo = new Foo ();
+	GLib.debug (foo.bar_str);
+
+	return 0;
+}
+



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]