Skip to content
Snippets Groups Projects
Unverified Commit 9ea995ef authored by Tom Robinson's avatar Tom Robinson
Browse files

Negative number literal tests

parent cb5ce74a
No related branches found
No related tags found
No related merge requests found
......@@ -52,6 +52,10 @@ describe("lib/expressions/parser", () => {
expect(compile("1 + 2 + 3 * 4 * 5", expressionOpts)).toEqual(["+", 1, 2, ["*", 3, 4, 5]]);
});
it("can handle negative number literals", () => {
expect(compile("1 + -1", expressionOpts)).toEqual(["+", 1, -1]);
});
// quoted field name w/ a space in it
it("can parse a field with quotes and spaces", () => {
expect(compile("\"Toucan Sam\" + B", expressionOpts)).toEqual(["+", ['field-id', 10], ['field-id', 2]]);
......@@ -75,6 +79,10 @@ describe("lib/expressions/parser", () => {
expect(compile("Sum(A)", aggregationOpts)).toEqual(["sum", ["field-id", 1]]);
});
it("can handle negative number literals in aggregations", () => {
expect(compile("-1 * Count", aggregationOpts)).toEqual(["*", -1, ["count"]]);
});
it("can parse complex aggregation", () => {
expect(compile("1 - Sum(A * 2) / Count", aggregationOpts)).toEqual(["-", 1, ["/", ["sum", ["*", ["field-id", 1], 2]], ["count"]]]);
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment