From 40ed027f20353fa7e3420bff1cc313a739d48527 Mon Sep 17 00:00:00 2001 From: Mathias Hasselmann Date: Tue, 7 Aug 2007 21:38:54 +0000 Subject: [PATCH] test exception handling when iterating over Gee collections - currently 2007-08-07 Mathias Hasselmann * tests/test-033.vala, tests/testrunner.sh: test exception handling when iterating over Gee collections - currently results in segmentation fault svn path=/trunk/; revision=441 --- ChangeLog | 5 +++++ tests/test-033.vala | 35 +++++++++++++++++++++++++++++++++-- tests/testrunner.sh | 8 ++++---- 3 files changed, 42 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1acb033..0d9f132 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-08-07 Mathias Hasselmann + + * tests/test-033.vala, tests/testrunner.sh: test exception handling when + iterating over Gee collections - currently results in segmentation fault + 2007-08-07 Jürg Billeter * vapi/Makefile.am, vapi/hildon-1.deps, vapi/hildon-1.vala, diff --git a/tests/test-033.vala b/tests/test-033.vala index 9d9109c..af2398c 100644 --- a/tests/test-033.vala +++ b/tests/test-033.vala @@ -1,9 +1,11 @@ using GLib; +using Gee; [ErrorDomain] enum Maman.BarError { FOO, - BAR + BAR, + LIST } class Maman.Bar { @@ -27,6 +29,17 @@ class Maman.Bar { stdout.printf (" 4"); } + public Gee.List list () throws BarError { + Gee.List result = new ArrayList (); + + result.add (" FOO"); + result.add (" BAR"); + + throw new BarError.LIST (" 14"); + + return result; + } + public void run () { stdout.printf (" 2"); @@ -49,6 +62,24 @@ class Maman.Bar { } stdout.printf (" 10"); + + try { + foreach (string s in list ()) { + stdout.printf (" 11"); + + stdout.printf (" %s", s); + + stdout.printf (" 12"); + } + } catch (BarError e) { + stdout.printf (" 13"); + + stdout.printf ("%s", e.message); + + stdout.printf (" 15"); + } + + stdout.printf (" 16"); } static int main (string[] args) { @@ -57,7 +88,7 @@ class Maman.Bar { var bar = new Bar (); bar.run (); - stdout.printf (" 11\n"); + stdout.printf (" 17\n"); return 0; } diff --git a/tests/testrunner.sh b/tests/testrunner.sh index b9e82c0..2a19f1f 100755 --- a/tests/testrunner.sh +++ b/tests/testrunner.sh @@ -26,20 +26,20 @@ vapidir=$topbuilddir/vapi VALAC=$topbuilddir/compiler/valac CC="gcc -std=c99" -CFLAGS="-O0 -g3" -LDLIBS="-lm" +CFLAGS="-O0 -g3 -I.." +LDLIBS="-lm ../gee/.libs/libgee.a" CODE=0 for testcasesource in "$@" do testcase=${testcasesource/.vala/} - if ! $VALAC --vapidir "$vapidir" $testcase.vala > $testcase.err 2>&1 + if ! $VALAC --vapidir "$vapidir" --pkg gee-1.0 $testcase.vala > $testcase.err 2>&1 then CODE=1 continue fi - if ! $CC $CFLAGS $(pkg-config --cflags --libs gobject-2.0) $LDLIBS -o $testcase $testcase.c > $testcase.err 2>&1 + if ! $CC $CFLAGS $(pkg-config --cflags --libs gobject-2.0) -o $testcase $testcase.c $LDLIBS > $testcase.err 2>&1 then CODE=1 continue -- 2.7.4