[glom] Import tests: Disable tests that check for incorrect or useless behaviour.



commit 774c333440b88b52cd373f997a1e13f85d2b71c3
Author: Murray Cumming <murrayc murrayc com>
Date:   Mon Nov 15 00:45:09 2010 +0100

    Import tests: Disable tests that check for incorrect or useless behaviour.
    
    * tests/import/test_parsing.cc: Comment out the test to ensure that we
    - Ignore rows with no ending newline.
    - Ignore field values that are not quoted.
    because we should not do that.
    Also add comments explaining the regular expressions.

 ChangeLog                    |   10 ++++++++++
 tests/import/test_parsing.cc |   18 +++++++++++++-----
 2 files changed, 23 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index befc189..4f22993 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2010-11-15  Murray Cumming  <murrayc murrayc com>
+
+	Import tests: Disable tests that check for incorrect or useless behaviour.
+
+	* tests/import/test_parsing.cc: Comment out the test to ensure that we 
+	- Ignore rows with no ending newline.
+	- Ignore field values that are not quoted.
+	because we should not do that.
+	Also add comments explaining the regular expressions.
+
 2010-11-14  Murray Cumming  <murrayc murrayc com>
 
 	Re-enable the import tests and partially deal with their race condition.
diff --git a/tests/import/test_parsing.cc b/tests/import/test_parsing.cc
index 52532e4..60c9708 100644
--- a/tests/import/test_parsing.cc
+++ b/tests/import/test_parsing.cc
@@ -87,6 +87,7 @@ int main(int argc, char* argv[])
   bool result = true;
   std::stringstream report;
 
+  // Test parsing of escaped quotes (double quotes in .csv mean a single quote in the actual field value):
   // test_dquoted_string
   {
     const char* raw = "\"a \"\"quoted\"\" token\",\"sans quotes\"\n";
@@ -100,9 +101,9 @@ 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.
   /*
-  // test_skip_on_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);
@@ -117,26 +118,32 @@ int main(int argc, char* argv[])
   */
 
   // 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.
+  /*
   {
     const char* raw = "this,line,contains,only,empty,tokens\n";
     const bool finished_parsing = ImportTests::run_parser_from_buffer(&connect_signals, raw);
 
     const bool passed = (finished_parsing &&
-                         check_tokens("^$") &&
+                         check_tokens("^$") &&  //Matches empty strings.
                          6 == get_tokens_instance().size());
     get_tokens_instance().clear();
 
     if(!ImportTests::check("test_skip_on_no_quotes_around_token", passed, report))
       result = false;
   }
+  */
 
   // test_skip_spaces_around_separators
+  // TODO: This seems wise, but where is it specified? murrayc.
   {
     const char* raw = "\"spaces\" , \"around\", \"separators\"\n";
     const bool finished_parsing = ImportTests::run_parser_from_buffer(&connect_signals, raw);
 
     const bool passed = (finished_parsing &&
-                         check_tokens("^(spaces|around|separators)$") &&
+                         check_tokens("^(spaces|around|separators)$") && //Matches these words with nothing else at the start or end.
                          3 == get_tokens_instance().size());
     get_tokens_instance().clear();
 
@@ -146,12 +153,13 @@ int main(int argc, char* argv[])
   }
 
   // test_fail_on_non_comma_separators
+  // TODO: Where is this behaviour (ignoring text between quoted text) specified?
   {
     const char* raw = "\"cannot\"\t\"tokenize\"\t\"this\"\n";
     const bool finished_parsing = ImportTests::run_parser_from_buffer(&connect_signals, raw);
 
     const bool passed = (finished_parsing &&
-                         check_tokens("^cannottokenizethis$") &&
+                         check_tokens("^cannottokenizethis$") && //Matches this text with nothing else at the start or end.
                          1 == get_tokens_instance().size());
     get_tokens_instance().clear();
 
@@ -165,7 +173,7 @@ int main(int argc, char* argv[])
     const bool finished_parsing = ImportTests::run_parser_from_buffer(&connect_signals, raw);
 
     const bool passed = (finished_parsing &&
-                         check_tokens("^(cell with\nnewline|token on next line)$") &&
+                         check_tokens("^(cell with\nnewline|token on next line)$") && //Matches these texts with nothing else at the start or end.
                          2 == get_tokens_instance().size());
     get_tokens_instance().clear();
 



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