spreadsheet
typeScript/javascript spreadsheet parser, with formulas.
git clone https://git.vogt.world/spreadsheet.git
Log | Files | README.md
← Commit log
commit
message
[ParserTests] fixing some tests, documenting TODOs
author
Ben Vogt <[email protected]>
date
2017-12-11 00:16:12
stats
1 file(s) changed, 8 insertions(+), 19 deletions(-)
files
tests/Parser/ParseEngineTest.ts
 1diff --git a/tests/Parser/ParseEngineTest.ts b/tests/Parser/ParseEngineTest.ts
 2index f5f0f06..34a4393 100644
 3--- a/tests/Parser/ParseEngineTest.ts
 4+++ b/tests/Parser/ParseEngineTest.ts
 5@@ -448,15 +448,14 @@ test("Parse and throw error literal", function () {
 6 
 7 test("Parse plain numbers", function() {
 8   assertEquals(parser.parse('10'), 10);
 9-  // assertEquals('=.1', 0.1); // TODO: Fails from parse error, but should pass
10-  // assertEquals(parser.parse('0.1'), 0.1); // TODO: Can't coerce to number?
11+  // assertEquals(parser.parse('.1'), 0.1); // TODO: Fails because our parser doesn't expect a decimal right away.
12   assertEquals(parser.parse('+1'), 1);
13   assertEquals(parser.parse('-1'), -1);
14   assertEquals(parser.parse('++1'), 1);
15   assertEquals(parser.parse('--1'), 1);
16   assertEquals(parser.parse('10e1'), 100);
17   assertEquals(parser.parse('0e1'), 0);
18-  // assertEquals('=0.e1', 0); // TODO: Fails from parse error, but should pass
19+  // assertEquals(parser.parse('0.e1'), 0); // TODO: Fails. After decimal, finds 'e' and thinks it's a variable.
20   assertEquals(parser.parse('-10e1'), -100);
21   assertEquals(parser.parse('+10e1'), 100);
22   assertEquals(parser.parse('++10e1'), 100);
23@@ -507,7 +506,7 @@ test("Parse strings", function(){
24   catchAndAssertEquals(function () {
25     parser.parse('"str"+"str"');
26   }, VALUE_ERROR);
27-  // assertEquals("='str'", PARSE_ERROR); // TODO: Parses, but it shouldn't.
28+  // assertEquals("='str'", PARSE_ERROR); // TODO: Parses, but we should not allow single-quote strings.
29 });
30 
31 test("Parse boolean literals", function(){
32@@ -518,28 +517,19 @@ test("Parse boolean literals", function(){
33 });
34 
35 test("Parse boolean logic", function(){
36-  // assertEquals('=(1=1)', true); // TODO: Fails because we compute the value, rather than checking equality
37-  // assertEquals('=(1=2)', false); // TODO: Fails because we compute the value, rather than checking equality
38+  // assertEquals(parser.parse('(1=1)'), true); // TODO: Fails because we compute the value, rather than checking equality
39+  // assertEquals(parser.parse('(1=2)'), false); // TODO: Fails because we compute the value, rather than checking equality
40   assertEquals(parser.parse('(1=1)+2'), 3);
41-
42 });
43 
44 
45 test("Parse range literal", function(){
46-  // assertEqualsArray('=[1, 2, 3]', [1, 2, 3]); // TODO: Fails because of low-level parser error
47-  // assertEqualsArray('=[]', []); // TODO: Fails because of low-level parser error
48-  // assertEqualsArray('=["str", "str"]', ["str", "str"]); // TODO: Fails because of low-level parser error
49-  // assertEqualsArray('=["str", [1, 2, 3], [1]]', ["str", [1, 2, 3], [1]]); // TODO: Fails because of low-level parser error
50-});
51-
52-
53-test("Parse range following comma", function(){
54-  // assertEquals('=SERIESSUM(1, 0, 1, [4, 5, 6])', 15);
55-  // assertEquals('=SERIESSUM([1], [0], [1], [4, 5, 6])', 15);
56+  // assertEqualsArray('=[1, 2, 3]', [1, 2, 3]); // TODO: Fails because we've not implemented array-level parsing.
57+  // assertEqualsArray('=[]', []);
58+  // assertEqualsArray('=["str", "str"]', ["str", "str"]);
59+  // assertEqualsArray('=["str", [1, 2, 3], [1]]', ["str", [1, 2, 3], [1]]);
60 });
61 
62 
63 
64-
65-
66 assertEquals(parser.parse('"one" = "one"'), true);