[gxml/gsoc2013: 60/69] GXmlTest.vala: override gtester handling of g_warnings; don't want to abort, but verify
- From: Richard Hans Schwarting <rschwart src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gxml/gsoc2013: 60/69] GXmlTest.vala: override gtester handling of g_warnings; don't want to abort, but verify
- Date: Sat, 27 Jul 2013 04:11:14 +0000 (UTC)
commit f4e861c02188b3575c92ee4a41de34117deb9b78
Author: Richard Schwarting <aquarichy gmail com>
Date: Sat Jul 27 00:01:54 2013 -0400
GXmlTest.vala: override gtester handling of g_warnings; don't want to abort, but verify
test/GXmlTest.vala | 23 ++++++++++++++++++++++-
1 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/test/GXmlTest.vala b/test/GXmlTest.vala
index 035bf31..3f5e07a 100644
--- a/test/GXmlTest.vala
+++ b/test/GXmlTest.vala
@@ -2,8 +2,29 @@
using GXml;
class GXmlTest {
+ internal static void GXmlLogFunc (string? log_domain, LogLevelFlags log_levels, string message) {
+ stdout.printf ("log domain [%s] log_levels [%d] message [%s]\n", log_domain, log_levels,
message);
+ GXmlTest.last_warning = message;
+ }
+
+ internal static string last_warning = "";
+ internal static void test_last_warning (string? match) {
+ if (last_warning != match) {
+ Test.message ("Expected last warning [%s] but found [%s]", match, last_warning);
+ Test.fail ();
+ }
+ last_warning = null;
+ }
+
public static int main (string[] args) {
- Test.init (ref args); // TODO: why ref? what if I just pass args?
+
+
+ // Sets 29 as fatal flags, 16 + 8 + 4 + 1; bits 0,2,3,4, recursion,error,critical,warning;
we'll want to undo that warning one so we can catch it
+ Test.init (ref args);
+
+ GLib.Log.set_handler ("gxml", GLib.LogLevelFlags.LEVEL_WARNING, GXmlTest.GXmlLogFunc);
+ GLib.Log.set_always_fatal (GLib.LogLevelFlags.FLAG_RECURSION | GLib.LogLevelFlags.LEVEL_ERROR
| GLib.LogLevelFlags.LEVEL_CRITICAL);
+
DocumentTest.add_tests ();
DomNodeTest.add_tests ();
ElementTest.add_tests ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]