[valadoc] tests: Add ErrorReporter tests



commit 21abc014c51850a1ab385f288df759b96b1bae81
Author: Florian Brosch <flo brosch gmail com>
Date:   Wed Jul 13 01:00:20 2011 +0200

    tests: Add ErrorReporter tests

 tests/Makefile.am                   |    1 +
 tests/libvaladoc/errorreporter.vala |   48 +++++++++++++++++++++++++++++++++++
 tests/testrunner.sh                 |    5 ++-
 3 files changed, 52 insertions(+), 2 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 3303350..fa3e37f 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -15,6 +15,7 @@ noinst_PROGRAMS = \
 TESTS_ENVIRONMENT = EXEEXT=$(EXEEXT) $(srcdir)/testrunner.sh
 
 TESTS = \
+	libvaladoc/errorreporter.vala \
 	$(NULL)
 
 check-TESTS: $(TESTS)
diff --git a/tests/libvaladoc/errorreporter.vala b/tests/libvaladoc/errorreporter.vala
new file mode 100644
index 0000000..93ec7b4
--- /dev/null
+++ b/tests/libvaladoc/errorreporter.vala
@@ -0,0 +1,48 @@
+
+using Valadoc;
+
+void main () {
+	var reporter = new ErrorReporter ();
+	assert (reporter.warnings == 0);
+	assert (reporter.errors == 0);
+
+	// simple errors:
+	reporter.simple_error ("error 1 %d %s", 1, "foo");
+	assert (reporter.warnings == 0);
+	assert (reporter.errors == 1);
+
+	reporter.simple_error ("error 2");
+	assert (reporter.warnings == 0);
+	assert (reporter.errors == 2);
+
+
+	// simple warnings:
+	reporter.simple_warning ("warning 1 %d %s", 1, "foo");
+	assert (reporter.warnings == 1);
+	assert (reporter.errors == 2);
+
+	reporter.simple_warning ("warning 2");
+	assert (reporter.warnings == 2);
+	assert (reporter.errors == 2);
+
+
+	// errors:
+	reporter.error ("file", 1, 1, 1, "line", "error, complex, 1 %d %s", 1, "foo");
+	assert (reporter.warnings == 2);
+	assert (reporter.errors == 3);
+
+	reporter.error ("file", 1, 1, 1, "line", "error, complex, 2");
+	assert (reporter.warnings == 2);
+	assert (reporter.errors == 4);
+
+
+	// warnngs:
+	reporter.warning ("file", 1, 1, 1, "line", "warning, complex, 1 %d %s", 1, "foo");
+	assert (reporter.warnings == 3);
+	assert (reporter.errors == 4);
+
+	reporter.warning ("file", 1, 1, 1, "line", "warning, complex, 2");
+	assert (reporter.warnings == 4);
+	assert (reporter.errors == 4);
+}
+
diff --git a/tests/testrunner.sh b/tests/testrunner.sh
index 531dbd5..70fe8b4 100755
--- a/tests/testrunner.sh
+++ b/tests/testrunner.sh
@@ -27,11 +27,12 @@ topsrcdir=$srcdir/..
 vapidir=$topsrcdir/vapi
 
 export G_DEBUG=fatal_warnings
+export PKG_CONFIG_PATH=../../src/libvaladoc
 
 VALAC=valac
-VALAFLAGS="--vapidir $vapidir --disable-warnings --main main --save-temps -X -g -X -O0 -X -pipe -X -lm -X -Werror=return-type -X -Werror=init-self -X -Werror=implicit -X -Werror=sequence-point -X -Werror=return-type -X -Werror=uninitialized -X -Werror=pointer-arith -X -Werror=int-to-pointer-cast -X -Werror=pointer-to-int-cast"
+VALAFLAGS="--vapidir ../../src/libvaladoc --pkg valadoc-1.0 --pkg gee-1.0 --disable-warnings --main main --save-temps -X -g -X -O0 -X -pipe -X -lm -X -Werror=return-type -X -Werror=init-self -X -Werror=implicit -X -Werror=sequence-point -X -Werror=return-type -X -Werror=uninitialized -X -Werror=pointer-arith -X -Werror=int-to-pointer-cast -X -Werror=pointer-to-int-cast -X -L../../src/libvaladoc/.libs -X -I../../src/libvaladoc"
 VAPIGEN=$topbuilddir/vapigen/vapigen
-VAPIGENFLAGS="--vapidir $vapidir"
+VAPIGENFLAGS=
 
 function testheader() {
 	if [ "$1" = "Packages:" ]; then



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