Unit Tests

- Fixed tests regarding quoted strings coming out of the Lexer.
This commit is contained in:
Paul Beckingham
2015-02-27 00:16:14 -05:00
parent 9dad0c7eb6
commit 2811b9a571

View File

@@ -101,7 +101,7 @@ int main (int argc, char** argv)
t.is (tokens[0].first, "one", "tokens[0] = 'left'"); // 30 t.is (tokens[0].first, "one", "tokens[0] = 'left'"); // 30
t.is (Lexer::typeName (tokens[0].second), "identifier", "tokens[0] = identifier"); t.is (Lexer::typeName (tokens[0].second), "identifier", "tokens[0] = identifier");
t.is (tokens[1].first, "two 'three'", "tokens[1] = 'two 'three''"); t.is (tokens[1].first, "'two 'three''", "tokens[1] = 'two 'three''");
t.is (Lexer::typeName (tokens[1].second), "string", "tokens[1] = string"); t.is (Lexer::typeName (tokens[1].second), "string", "tokens[1] = string");
t.is (tokens[2].first, "+", "tokens[2] = '+'"); t.is (tokens[2].first, "+", "tokens[2] = '+'");
@@ -143,7 +143,7 @@ int main (int argc, char** argv)
t.is (tokens[14].first, "and", "tokens[14] = 'and'"); // 60 t.is (tokens[14].first, "and", "tokens[14] = 'and'"); // 60
t.is (Lexer::typeName (tokens[14].second), "op", "tokens[14] = op"); t.is (Lexer::typeName (tokens[14].second), "op", "tokens[14] = op");
t.is (tokens[15].first, "", "tokens[15] = \\u20ac --> ''"); t.is (tokens[15].first, "'€'", "tokens[15] = \\u20ac --> ''€''");
t.is (Lexer::typeName (tokens[15].second), "string", "tokens[15] = string"); t.is (Lexer::typeName (tokens[15].second), "string", "tokens[15] = string");
// Test for ISO-8601 dates (favoring dates in ambiguous cases). // Test for ISO-8601 dates (favoring dates in ambiguous cases).
@@ -367,7 +367,7 @@ int main (int argc, char** argv)
t.is (items[4], "+", "split ' +-* a+b 12.3e4 'c d'' -> [4] '+'"); t.is (items[4], "+", "split ' +-* a+b 12.3e4 'c d'' -> [4] '+'");
t.is (items[5], "b", "split ' +-* a+b 12.3e4 'c d'' -> [5] 'b'"); t.is (items[5], "b", "split ' +-* a+b 12.3e4 'c d'' -> [5] 'b'");
t.is (items[6], "12.3e4", "split ' +-* a+b 12.3e4 'c d'' -> [6] '12.3e4'"); t.is (items[6], "12.3e4", "split ' +-* a+b 12.3e4 'c d'' -> [6] '12.3e4'");
t.is (items[7], "c d", "split ' +-* a+b 12.3e4 'c d'' -> [7] 'c d'"); t.is (items[7], "'c d'", "split ' +-* a+b 12.3e4 'c d'' -> [7] ''c d''");
// Test common expression element. // Test common expression element.
unsplit = "name=value"; unsplit = "name=value";