vala r2060 - in trunk: . tests tests/basic-types tests/control-flow tests/methods tests/objects
- From: juergbi svn gnome org
- To: svn-commits-list gnome org
- Subject: vala r2060 - in trunk: . tests tests/basic-types tests/control-flow tests/methods tests/objects
- Date: Sat, 22 Nov 2008 21:09:35 +0000 (UTC)
Author: juergbi
Date: Sat Nov 22 21:09:35 2008
New Revision: 2060
URL: http://svn.gnome.org/viewvc/vala?rev=2060&view=rev
Log:
2008-11-22 JÃrg Billeter <j bitron ch>
* tests/:
Prepare support for more complex test cases
Added:
trunk/tests/arrays.test (contents, props changed)
- copied, changed from r2059, /trunk/tests/arrays.vala
trunk/tests/basic-types/floats.test
- copied, changed from r2059, /trunk/tests/basic-types/floats.vala
trunk/tests/basic-types/integers.test
- copied, changed from r2059, /trunk/tests/basic-types/integers.vala
trunk/tests/basic-types/strings.test
- copied, changed from r2059, /trunk/tests/basic-types/strings.vala
trunk/tests/basic-types/test-027.test
- copied, changed from r2059, /trunk/tests/basic-types/test-027.vala
trunk/tests/control-flow/break.test
- copied, changed from r2059, /trunk/tests/control-flow/break.vala
trunk/tests/control-flow/expressions-conditional.test
- copied, changed from r2059, /trunk/tests/control-flow/expressions-conditional.vala
trunk/tests/control-flow/for.test
- copied, changed from r2059, /trunk/tests/control-flow/for.vala
trunk/tests/control-flow/switch.test
- copied, changed from r2059, /trunk/tests/control-flow/switch.vala
trunk/tests/delegates.test (contents, props changed)
- copied, changed from r2059, /trunk/tests/delegates.vala
trunk/tests/enums.test (contents, props changed)
- copied, changed from r2059, /trunk/tests/enums.vala
trunk/tests/exceptions.test (contents, props changed)
- copied, changed from r2059, /trunk/tests/exceptions.vala
trunk/tests/methods/lambda.test
- copied, changed from r2059, /trunk/tests/methods/lambda.vala
trunk/tests/namespaces.test (contents, props changed)
- copied, changed from r2059, /trunk/tests/namespaces.vala
trunk/tests/objects/classes.test
- copied, changed from r2059, /trunk/tests/objects/classes.vala
trunk/tests/objects/fields.test
- copied, changed from r2059, /trunk/tests/objects/fields.vala
trunk/tests/objects/interfaces.test
- copied, changed from r2059, /trunk/tests/objects/interfaces.vala
trunk/tests/objects/methods.test
- copied, changed from r2059, /trunk/tests/objects/methods.vala
trunk/tests/objects/properties.test
- copied, changed from r2059, /trunk/tests/objects/properties.vala
trunk/tests/objects/signals.test
- copied, changed from r2059, /trunk/tests/objects/signals.vala
trunk/tests/objects/test-025.test
- copied, changed from r2059, /trunk/tests/objects/test-025.vala
trunk/tests/objects/test-026.test
- copied, changed from r2059, /trunk/tests/objects/test-026.vala
trunk/tests/objects/test-029.test
- copied, changed from r2059, /trunk/tests/objects/test-029.vala
trunk/tests/objects/test-034.test
- copied, changed from r2059, /trunk/tests/objects/test-034.vala
trunk/tests/pointers.test (contents, props changed)
- copied, changed from r2059, /trunk/tests/pointers.vala
trunk/tests/structs.test (contents, props changed)
- copied, changed from r2059, /trunk/tests/structs.vala
trunk/tests/test-023.test (contents, props changed)
- copied, changed from r2059, /trunk/tests/test-023.vala
Removed:
trunk/tests/arrays.exp
trunk/tests/arrays.vala
trunk/tests/basic-types/floats.exp
trunk/tests/basic-types/floats.vala
trunk/tests/basic-types/integers.exp
trunk/tests/basic-types/integers.vala
trunk/tests/basic-types/strings.exp
trunk/tests/basic-types/strings.vala
trunk/tests/basic-types/test-027.exp
trunk/tests/basic-types/test-027.vala
trunk/tests/control-flow/break.exp
trunk/tests/control-flow/break.vala
trunk/tests/control-flow/expressions-conditional.exp
trunk/tests/control-flow/expressions-conditional.vala
trunk/tests/control-flow/for.exp
trunk/tests/control-flow/for.vala
trunk/tests/control-flow/switch.exp
trunk/tests/control-flow/switch.vala
trunk/tests/delegates.exp
trunk/tests/delegates.vala
trunk/tests/enums.exp
trunk/tests/enums.vala
trunk/tests/exceptions.exp
trunk/tests/exceptions.vala
trunk/tests/hello.exp
trunk/tests/hello.vala
trunk/tests/methods/lambda.exp
trunk/tests/methods/lambda.vala
trunk/tests/namespaces.exp
trunk/tests/namespaces.vala
trunk/tests/objects/classes.exp
trunk/tests/objects/classes.vala
trunk/tests/objects/fields.exp
trunk/tests/objects/fields.vala
trunk/tests/objects/interfaces.exp
trunk/tests/objects/interfaces.vala
trunk/tests/objects/methods.exp
trunk/tests/objects/methods.vala
trunk/tests/objects/properties.exp
trunk/tests/objects/properties.vala
trunk/tests/objects/signals.exp
trunk/tests/objects/signals.vala
trunk/tests/objects/test-025.exp
trunk/tests/objects/test-025.vala
trunk/tests/objects/test-026.exp
trunk/tests/objects/test-026.vala
trunk/tests/objects/test-029.exp
trunk/tests/objects/test-029.vala
trunk/tests/objects/test-034.exp
trunk/tests/objects/test-034.vala
trunk/tests/pointers.exp
trunk/tests/pointers.vala
trunk/tests/structs.exp
trunk/tests/structs.vala
trunk/tests/test-023.exp
trunk/tests/test-023.vala
Modified:
trunk/ChangeLog
trunk/tests/Makefile.am
trunk/tests/testrunner.sh
Modified: trunk/tests/Makefile.am
==============================================================================
--- trunk/tests/Makefile.am (original)
+++ trunk/tests/Makefile.am Sat Nov 22 21:09:35 2008
@@ -15,67 +15,37 @@
TESTS_ENVIRONMENT = EXEEXT=$(EXEEXT) $(srcdir)/testrunner.sh
TESTS = \
- hello.vala \
- basic-types/floats.vala \
- basic-types/integers.vala \
- basic-types/strings.vala \
- basic-types/test-027.vala \
- namespaces.vala \
- methods/lambda.vala \
- control-flow/break.vala \
- control-flow/expressions-conditional.vala \
- control-flow/for.vala \
- control-flow/switch.vala \
- arrays.vala \
- enums.vala \
- structs.vala \
- delegates.vala \
- objects/classes.vala \
- objects/fields.vala \
- objects/interfaces.vala \
- objects/methods.vala \
- objects/properties.vala \
- objects/signals.vala \
- objects/test-025.vala \
- objects/test-026.vala \
- objects/test-029.vala \
- objects/test-034.vala \
- exceptions.vala \
- pointers.vala \
- test-023.vala \
+ basic-types/floats.test \
+ basic-types/integers.test \
+ basic-types/strings.test \
+ basic-types/test-027.test \
+ namespaces.test \
+ methods/lambda.test \
+ control-flow/break.test \
+ control-flow/expressions-conditional.test \
+ control-flow/for.test \
+ control-flow/switch.test \
+ arrays.test \
+ enums.test \
+ structs.test \
+ delegates.test \
+ objects/classes.test \
+ objects/fields.test \
+ objects/interfaces.test \
+ objects/methods.test \
+ objects/properties.test \
+ objects/signals.test \
+ objects/test-025.test \
+ objects/test-026.test \
+ objects/test-029.test \
+ objects/test-034.test \
+ exceptions.test \
+ pointers.test \
+ test-023.test \
$(NULL)
EXTRA_DIST = \
testrunner.sh \
$(TESTS) \
- \
- hello.exp \
- basic-types/floats.exp \
- basic-types/integers.exp \
- basic-types/strings.exp \
- basic-types/test-027.exp \
- namespaces.exp \
- methods/lambda.exp \
- control-flow/break.exp \
- control-flow/expressions-conditional.exp \
- control-flow/for.exp \
- control-flow/switch.exp \
- arrays.exp \
- enums.exp \
- structs.exp \
- delegates.exp \
- objects/classes.exp \
- objects/fields.exp \
- objects/interfaces.exp \
- objects/methods.exp \
- objects/properties.exp \
- objects/signals.exp \
- objects/test-025.exp \
- objects/test-026.exp \
- objects/test-029.exp \
- objects/test-034.exp \
- exceptions.exp \
- pointers.exp \
- test-023.exp \
$(NULL)
Copied: trunk/tests/arrays.test (from r2059, /trunk/tests/arrays.vala)
==============================================================================
--- /trunk/tests/arrays.vala (original)
+++ trunk/tests/arrays.test Sat Nov 22 21:09:35 2008
@@ -1,3 +1,6 @@
+
+Program: test
+
using GLib;
class Maman.Foo : Object {
Copied: trunk/tests/basic-types/floats.test (from r2059, /trunk/tests/basic-types/floats.vala)
==============================================================================
--- /trunk/tests/basic-types/floats.vala (original)
+++ trunk/tests/basic-types/floats.test Sat Nov 22 21:09:35 2008
@@ -1,3 +1,6 @@
+
+Program: test
+
using GLib;
class Maman.Foo : Object {
Copied: trunk/tests/basic-types/integers.test (from r2059, /trunk/tests/basic-types/integers.vala)
==============================================================================
--- /trunk/tests/basic-types/integers.vala (original)
+++ trunk/tests/basic-types/integers.test Sat Nov 22 21:09:35 2008
@@ -1,3 +1,6 @@
+
+Program: test
+
using GLib;
class Maman.Bar : Object {
Copied: trunk/tests/basic-types/strings.test (from r2059, /trunk/tests/basic-types/strings.vala)
==============================================================================
--- /trunk/tests/basic-types/strings.vala (original)
+++ trunk/tests/basic-types/strings.test Sat Nov 22 21:09:35 2008
@@ -1,3 +1,6 @@
+
+Program: test
+
using GLib;
class Maman.Foo : Object {
Copied: trunk/tests/basic-types/test-027.test (from r2059, /trunk/tests/basic-types/test-027.vala)
==============================================================================
--- /trunk/tests/basic-types/test-027.vala (original)
+++ trunk/tests/basic-types/test-027.test Sat Nov 22 21:09:35 2008
@@ -1,3 +1,6 @@
+
+Program: test
+
using GLib;
class Maman.Bar : Object {
Copied: trunk/tests/control-flow/break.test (from r2059, /trunk/tests/control-flow/break.vala)
==============================================================================
--- /trunk/tests/control-flow/break.vala (original)
+++ trunk/tests/control-flow/break.test Sat Nov 22 21:09:35 2008
@@ -1,3 +1,6 @@
+
+Program: test
+
using GLib;
class Maman.Bar : Object {
Copied: trunk/tests/control-flow/expressions-conditional.test (from r2059, /trunk/tests/control-flow/expressions-conditional.vala)
==============================================================================
--- /trunk/tests/control-flow/expressions-conditional.vala (original)
+++ trunk/tests/control-flow/expressions-conditional.test Sat Nov 22 21:09:35 2008
@@ -1,3 +1,6 @@
+
+Program: test
+
using GLib;
class Maman.Bar : Object {
Copied: trunk/tests/control-flow/for.test (from r2059, /trunk/tests/control-flow/for.vala)
==============================================================================
--- /trunk/tests/control-flow/for.vala (original)
+++ trunk/tests/control-flow/for.test Sat Nov 22 21:09:35 2008
@@ -1,3 +1,6 @@
+
+Program: test
+
void void_method () {
}
Copied: trunk/tests/control-flow/switch.test (from r2059, /trunk/tests/control-flow/switch.vala)
==============================================================================
--- /trunk/tests/control-flow/switch.vala (original)
+++ trunk/tests/control-flow/switch.test Sat Nov 22 21:09:35 2008
@@ -1,3 +1,6 @@
+
+Program: test
+
using GLib;
class Maman.Bar : Object {
Copied: trunk/tests/delegates.test (from r2059, /trunk/tests/delegates.vala)
==============================================================================
--- /trunk/tests/delegates.vala (original)
+++ trunk/tests/delegates.test Sat Nov 22 21:09:35 2008
@@ -1,3 +1,6 @@
+
+Program: test
+
using GLib;
public static delegate void Maman.VoidCallback ();
Copied: trunk/tests/enums.test (from r2059, /trunk/tests/enums.vala)
==============================================================================
--- /trunk/tests/enums.vala (original)
+++ trunk/tests/enums.test Sat Nov 22 21:09:35 2008
@@ -1,3 +1,6 @@
+
+Program: test
+
using GLib;
enum Maman.Foo {
Copied: trunk/tests/exceptions.test (from r2059, /trunk/tests/exceptions.vala)
==============================================================================
--- /trunk/tests/exceptions.vala (original)
+++ trunk/tests/exceptions.test Sat Nov 22 21:09:35 2008
@@ -1,3 +1,6 @@
+
+Program: test
+
using GLib;
errordomain Maman.BarError {
Copied: trunk/tests/methods/lambda.test (from r2059, /trunk/tests/methods/lambda.vala)
==============================================================================
--- /trunk/tests/methods/lambda.vala (original)
+++ trunk/tests/methods/lambda.test Sat Nov 22 21:09:35 2008
@@ -1,3 +1,6 @@
+
+Program: test
+
using GLib;
static delegate int Maman.ActionCallback (int i);
Copied: trunk/tests/namespaces.test (from r2059, /trunk/tests/namespaces.vala)
==============================================================================
--- /trunk/tests/namespaces.vala (original)
+++ trunk/tests/namespaces.test Sat Nov 22 21:09:35 2008
@@ -1,3 +1,6 @@
+
+Program: test
+
using Foo.Sub;
public class GlobalTestClass {
Copied: trunk/tests/objects/classes.test (from r2059, /trunk/tests/objects/classes.vala)
==============================================================================
--- /trunk/tests/objects/classes.vala (original)
+++ trunk/tests/objects/classes.test Sat Nov 22 21:09:35 2008
@@ -1,3 +1,6 @@
+
+Program: test
+
using GLib;
[Compact]
Copied: trunk/tests/objects/fields.test (from r2059, /trunk/tests/objects/fields.vala)
==============================================================================
--- /trunk/tests/objects/fields.vala (original)
+++ trunk/tests/objects/fields.test Sat Nov 22 21:09:35 2008
@@ -1,3 +1,6 @@
+
+Program: test
+
using GLib;
[Compact]
Copied: trunk/tests/objects/interfaces.test (from r2059, /trunk/tests/objects/interfaces.vala)
==============================================================================
--- /trunk/tests/objects/interfaces.vala (original)
+++ trunk/tests/objects/interfaces.test Sat Nov 22 21:09:35 2008
@@ -1,3 +1,6 @@
+
+Program: test
+
using GLib;
interface Maman.Ibaz : Object {
Copied: trunk/tests/objects/methods.test (from r2059, /trunk/tests/objects/methods.vala)
==============================================================================
--- /trunk/tests/objects/methods.vala (original)
+++ trunk/tests/objects/methods.test Sat Nov 22 21:09:35 2008
@@ -1,3 +1,6 @@
+
+Program: test
+
using GLib;
class Maman.Bar : Object {
Copied: trunk/tests/objects/properties.test (from r2059, /trunk/tests/objects/properties.vala)
==============================================================================
--- /trunk/tests/objects/properties.vala (original)
+++ trunk/tests/objects/properties.test Sat Nov 22 21:09:35 2008
@@ -1,3 +1,6 @@
+
+Program: test
+
using GLib;
public class Sample : Object {
Copied: trunk/tests/objects/signals.test (from r2059, /trunk/tests/objects/signals.vala)
==============================================================================
--- /trunk/tests/objects/signals.vala (original)
+++ trunk/tests/objects/signals.test Sat Nov 22 21:09:35 2008
@@ -1,3 +1,6 @@
+
+Program: test
+
using GLib;
class Maman.Foo : Object {
Copied: trunk/tests/objects/test-025.test (from r2059, /trunk/tests/objects/test-025.vala)
==============================================================================
--- /trunk/tests/objects/test-025.vala (original)
+++ trunk/tests/objects/test-025.test Sat Nov 22 21:09:35 2008
@@ -1,3 +1,6 @@
+
+Program: test
+
using GLib;
class Maman.Bar : Object {
Copied: trunk/tests/objects/test-026.test (from r2059, /trunk/tests/objects/test-026.vala)
==============================================================================
--- /trunk/tests/objects/test-026.vala (original)
+++ trunk/tests/objects/test-026.test Sat Nov 22 21:09:35 2008
@@ -1,3 +1,6 @@
+
+Program: test
+
using GLib;
class Maman.Bar : Object {
Copied: trunk/tests/objects/test-029.test (from r2059, /trunk/tests/objects/test-029.vala)
==============================================================================
--- /trunk/tests/objects/test-029.vala (original)
+++ trunk/tests/objects/test-029.test Sat Nov 22 21:09:35 2008
@@ -1,3 +1,6 @@
+
+Program: test
+
using GLib;
class Maman.Foo : Object {
Copied: trunk/tests/objects/test-034.test (from r2059, /trunk/tests/objects/test-034.vala)
==============================================================================
--- /trunk/tests/objects/test-034.vala (original)
+++ trunk/tests/objects/test-034.test Sat Nov 22 21:09:35 2008
@@ -1,3 +1,6 @@
+
+Program: test
+
using GLib;
class Maman.A : Object {
Copied: trunk/tests/pointers.test (from r2059, /trunk/tests/pointers.vala)
==============================================================================
--- /trunk/tests/pointers.vala (original)
+++ trunk/tests/pointers.test Sat Nov 22 21:09:35 2008
@@ -1,3 +1,6 @@
+
+Program: test
+
using GLib;
struct SimpleStruct {
Copied: trunk/tests/structs.test (from r2059, /trunk/tests/structs.vala)
==============================================================================
--- /trunk/tests/structs.vala (original)
+++ trunk/tests/structs.test Sat Nov 22 21:09:35 2008
@@ -1,3 +1,6 @@
+
+Program: test
+
using GLib;
struct SimpleStruct {
Copied: trunk/tests/test-023.test (from r2059, /trunk/tests/test-023.vala)
==============================================================================
--- /trunk/tests/test-023.vala (original)
+++ trunk/tests/test-023.test Sat Nov 22 21:09:35 2008
@@ -1,3 +1,6 @@
+
+Program: test
+
using GLib;
class Maman.Foo : Object {
Modified: trunk/tests/testrunner.sh
==============================================================================
--- trunk/tests/testrunner.sh (original)
+++ trunk/tests/testrunner.sh Sat Nov 22 21:09:35 2008
@@ -25,10 +25,6 @@
srcdir=`dirname $0`
topsrcdir=$srcdir/..
vapidir=$topsrcdir/vapi
-exe=$EXEEXT
-
-# make sure we detect failed test cases
-set -o pipefail
export G_DEBUG=fatal_warnings
@@ -39,31 +35,94 @@
CODE=0
-for testcasesource in "$@"
-do
- testsrc=${testcasesource/.vala/}
- if ! $VALAC -C --vapidir "$vapidir" --basedir $topsrcdir -d $topbuilddir $testsrc.vala > $testsrc.err 2>&1
- then
- echo "ERROR: Compiling" $testcasesource
- cat $testsrc.err
- CODE=1
- continue
+function testheader() {
+ if [ "$1" = "Packages:" ]; then
+ shift
+ PACKAGES="$@"
+ for pkg in $PACKAGES; do
+ if [ "$pkg" = "dbus-glib-1" ]; then
+ echo 'eval `dbus-launch --sh-syntax`' >> prepare
+ echo 'trap "kill $DBUS_SESSION_BUS_PID" INT TERM EXIT' >> prepare
+ fi
+ done
fi
- if ! $CC $CFLAGS $testsrc.c $(pkg-config --cflags --libs gobject-2.0) -o $testsrc $LDLIBS > $testsrc.err 2>&1
- then
- echo "ERROR: Compiling" $testsrc.c
- cat $testsrc.err
- CODE=1
- continue
+}
+
+function sourceheader() {
+ if [ "$1" = "Program:" ]; then
+ PROGRAM=$2
+ SOURCEFILE=$PROGRAM.vala
+ fi
+}
+
+function sourceend() {
+ if [ -n "$PROGRAM" ]; then
+ echo "$VALAC $(echo $PACKAGES | xargs -n 1 -r echo --pkg) -C $SOURCEFILE" >> build
+ echo "$CC $CFLAGS $LDLIBS \$(pkg-config --cflags --libs glib-2.0 gobject-2.0 $PACKAGES) -o $PROGRAM$EXEEXT $PROGRAM.c" >> build
+ echo "./$PROGRAM$EXEEXT" > check
fi
- if ./$testsrc 2>&1 | tee $testsrc.err | cmp -s $testsrc.exp
- then
- rm $testsrc.c $testsrc.h $testsrc$exe $testsrc.err
- else
- echo "ERROR: test failed. This is the difference between" $testsrc.exp "and" $testsrc.err
- diff -u $testsrc.exp $testsrc.err
+}
+
+for testfile in "$@"; do
+ testname=$(basename $testfile)
+ testdir=${testname/.test/.d}
+ rm -rf $testdir
+ mkdir $testdir
+ cd $testdir
+
+ touch prepare build check cleanup
+
+ echo 'set -e' >> prepare
+
+ PART=0
+ INHEADER=1
+ PACKAGES=
+ PROGRAM=
+ cat "$builddir/$testfile" | while true; do
+ if IFS="" read -r line; then
+ if [ $PART -eq 0 ]; then
+ if [ -n "$line" ]; then
+ testheader $line
+ else
+ PART=1
+ fi
+ else
+ if [ $INHEADER -eq 1 ]; then
+ if [ -n "$line" ]; then
+ sourceheader $line
+ else
+ INHEADER=0
+ fi
+ else
+ if echo "$line" | grep -q "^[A-Za-z]\+:"; then
+ sourceend
+ PART=$(($PART + 1))
+ INHEADER=1
+ PROGRAM=
+ sourceheader $line
+ else
+ echo "$line" >> $SOURCEFILE
+ fi
+ fi
+ fi
+ else
+ sourceend
+ break
+ fi
+ done
+
+ cat prepare build check cleanup > script
+ if ! bash script >log 2>&1; then
+ cat log
CODE=1
fi
+
+ cd $builddir
+
+ if [ $CODE -eq 0 ]; then
+ rm -rf $testdir
+ fi
done
exit $CODE
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]