From cbb6decf9318954c9d6a408e0c06faf0c6bcff8b Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Wed, 18 Jun 2014 00:18:18 -0400 Subject: [PATCH] Unit Tests - Added Lexer test to split 'ordinary' into 'ordinary', not 'or' and 'dinary'. --- test/lexer.t.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/lexer.t.cpp b/test/lexer.t.cpp index 4e5479e5f..108b86d02 100644 --- a/test/lexer.t.cpp +++ b/test/lexer.t.cpp @@ -36,7 +36,7 @@ Context context; //////////////////////////////////////////////////////////////////////////////// int main (int argc, char** argv) { - UnitTest t (194); + UnitTest t (196); std::vector > tokens; std::string token; @@ -342,7 +342,7 @@ int main (int argc, char** argv) // Test common expression element. unsplit = "name=value"; Lexer::token_split (items, unsplit); - t.is (items.size (), (size_t) 3, "split 'name=value'"); + t.is (items.size (), (size_t) 3, "token_split 'name=value'"); if (items.size () == 3) { t.is (items[0], "name", "token_split 'name=value' -> [0] 'name'"); @@ -356,6 +356,12 @@ int main (int argc, char** argv) t.fail ("token_split 'name=value' -> [2] 'value'"); } + // Test unterminated tokens. + unsplit = " ordinary "; + Lexer::token_split (items, unsplit); + t.is (items.size (), (size_t) 1, "token_split 'ordinary' --> 1 token"); + t.is (items[0], "ordinary", "token_split 'ordinary' --> 'ordinary'"); + return 0; }