Commit 40ed027f authored by Mathias Hasselmann's avatar Mathias Hasselmann Committed by Mathias Hasselmann
Browse files

test exception handling when iterating over Gee collections - currently

2007-08-07  Mathias Hasselmann  <mathias.hasselmann@gmx.de>

	* 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
parent ee6b2d7e
2007-08-07 Mathias Hasselmann <mathias.hasselmann@gmx.de>
* 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 <j@bitron.ch>
* vapi/Makefile.am, vapi/hildon-1.deps, vapi/hildon-1.vala,
......
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<string> list () throws BarError {
Gee.List<string> result = new ArrayList<string> ();
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;
}
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment