[gxml] DocumentTest.vala: first testing of warnings



commit 3fc4dfb253236c7495ae52f4f0298b36c1781289
Author: Richard Schwarting <aquarichy gmail com>
Date:   Sat Jul 27 00:01:55 2013 -0400

    DocumentTest.vala: first testing of warnings

 test/DocumentTest.vala |   41 +++++++++++------------------------------
 1 files changed, 11 insertions(+), 30 deletions(-)
---
diff --git a/test/DocumentTest.vala b/test/DocumentTest.vala
index 8cc4f4c..faa7d2e 100644
--- a/test/DocumentTest.vala
+++ b/test/DocumentTest.vala
@@ -118,36 +118,17 @@ class DocumentTest : GXmlTest {
                                }
                        });
                Test.add_func ("/gxml/document/create_element", () => {
-                               try {
-                                       Document doc = get_doc ();
-                                       Element elem = null;
-
-                                       try {
-                                               elem = doc.create_element ("Banana");
-
-                                               assert (elem.tag_name == "Banana");
-                                               assert (elem.tag_name != "banana");
-                                       } catch (DomError e) {
-                                               assert_not_reached ();
-                                       }
-
-                                       try {
-                                               elem = doc.create_element ("ØÏØÏدÏØÏ  ²øœ³¤ïØ£");
-
-                                               /* TODO: want to test this, would need to
-                                                  circumvent libxml2 though, and would we end up wanting
-                                                  to validate all nodes libxml2 would let in when reading
-                                                  but not us? :S
-
-                                                  // We should not get this far
-                                                  assert_not_reached ();
-                                               */
-                                       } catch (DomError.INVALID_CHARACTER e) {
-                                       }
-                               } catch (GXml.DomError e) {
-                                       Test.message ("%s", e.message);
-                                       assert_not_reached ();
-                               }
+                               Document doc = get_doc ();
+                               Element elem = null;
+
+                               elem = doc.create_element ("Banana");
+                               test_error (DomException.NONE);
+                               assert (elem.tag_name == "Banana");
+                               assert (elem.tag_name != "banana");
+
+                               elem = doc.create_element ("ØÏØÏدÏØÏ  ²øœ³¤ïØ£");
+                               test_error (DomException.INVALID_CHARACTER);
+                               assert (elem == null);
                        });
                Test.add_func ("/gxml/document/create_document_fragment", () => {
                                try {


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