[glom] Import tests: Uncomment some tests and make them test what we really want.



commit 7dc2a416b8e63b23ef1ecb9ea51b2cdfa9b01186
Author: Murray Cumming <murrayc murrayc com>
Date:   Wed Nov 17 13:25:04 2010 +0100

    Import tests: Uncomment some tests and make them test what we really want.
    
    * tests/import/test_parsing.cc: Check that we do _not_ require ending newlines
    and check that we do _not_ require quotes around items.

 ChangeLog                    |    7 +++++++
 tests/import/test_parsing.cc |   28 +++++++++++-----------------
 2 files changed, 18 insertions(+), 17 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 74d5f30..35130b0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-11-17  Murray Cumming  <murrayc murrayc com>
+
+	Import tests: Uncomment some tests and make them test what we really want.
+
+	* tests/import/test_parsing.cc: Check that we do _not_ require ending newlines 
+	and check that we do _not_ require quotes around items.
+
 2010-11-15  Murray Cumming  <murrayc murrayc com>
 
 	Import tests: Disable more tests that do not seem useful.
diff --git a/tests/import/test_parsing.cc b/tests/import/test_parsing.cc
index 821c537..c2d7f93 100644
--- a/tests/import/test_parsing.cc
+++ b/tests/import/test_parsing.cc
@@ -101,40 +101,35 @@ int main(int argc, char* argv[])
       result = false;
   }
 
-  // test_skip_on_no_ending_newline
-  // Commented out, because why should we want to fail if there is no ending newline? murrayc.
-  /*
+  // Allow a line to have no newline at the end.
+  // test_allow_no_ending_newline
   {
     const char* raw = "\"token in first line\"\n\"2nd token\", \"but\", \"this\",\"line\",\"will\",\"be\",\"skipped\"";
     const bool finished_parsing = ImportTests::run_parser_from_buffer(&connect_signals, raw);
     const bool passed = (finished_parsing &&
                          check_tokens("token in first line") &&
-                         1 == get_tokens_instance().size());
+                         check_tokens("2nd token") &&
+                         8 == get_tokens_instance().size());
     get_tokens_instance().clear();
 
-    if(!ImportTests::check("test_skip_on_no_ending_newline", passed, report))
+    if(!ImportTests::check("test_allow_no_ending_newline", passed, report))
       result = false;
   }
-  */
 
-  // test_skip_on_no_quotes_around_token
-  //  Commented out, because why should we want to only parse items with quotes?
-  //  The wikipedia page (see the class documentatoin) says that quotes are optional
-  //  murrayc.
-  /*
+  //  Make sure that we do not demand quotes around items.
+  // test_allow_no_quotes
   {
-    const char* raw = "this,line,contains,only,empty,tokens\n";
+    const char* raw = "this,line,contains,some,tokens\n";
     const bool finished_parsing = ImportTests::run_parser_from_buffer(&connect_signals, raw);
 
     const bool passed = (finished_parsing &&
-                         check_tokens("^$") &&  //Matches empty strings.
-                         6 == get_tokens_instance().size());
+                         !check_tokens("^$") &&  //Check that there are no empty strings
+                         5 == get_tokens_instance().size());
     get_tokens_instance().clear();
 
-    if(!ImportTests::check("test_skip_on_no_quotes_around_token", passed, report))
+    if(!ImportTests::check("test_allow_no_quotes", passed, report))
       result = false;
   }
-  */
 
   // test_skip_spaces_around_separators
   // TODO: This seems wise, but where is it specified? murrayc.
@@ -166,7 +161,6 @@ int main(int argc, char* argv[])
     const bool passed = (finished_parsing &&
                          check_tokens("^cannottokenizethis$") && //Matches this text with nothing else at the start or end.
                          1 == get_tokens_instance().size());
-              print_tokens();
     get_tokens_instance().clear();
 
     if(!ImportTests::check("test_fail_on_non_comma_separators", passed, report))



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