test/unit/parser_compatability_test.rb in sparkql-1.2.3 vs test/unit/parser_compatability_test.rb in sparkql-1.2.4

- old
+ new

@@ -563,6 +563,21 @@ parser = Parser.new expression = parser.tokenize("cast(month(OriginalEntryTimestamp), 'character') Eq '3'").first assert parser.send(:check_type!, expression, :datetime) assert_equal '3', parser.escape_value(expression) end + + test "function with field and arithmetic" do + filter = "year(CloseDate) add 1 Eq 2017" + parser = Parser.new + expression = parser.tokenize(filter).first + assert parser.send(:check_type!, expression, :datetime) + end + + test "Cannot perform arithmetic on a String field" do + filter = "City Add 3.0 Eq 'Fargo'" + parser = Parser.new + expression = parser.tokenize(filter).first + # Type mismatch + assert !parser.send(:check_type!, expression, :datetime) + end end