tree-sitter/spec/runtime/arithmetic_spec.cpp
Max Brunsfeld 023a0c4f70 Fix a spec
2014-01-11 13:41:31 -08:00

27 lines
No EOL
748 B
C++

#include "spec_helper.h"
#include "document.h"
extern TSParseConfig ts_parse_config_arithmetic;
START_TEST
describe("arithmetic", []() {
TSDocument *document;
before_each([&]() {
document = TSDocumentMake();
TSDocumentSetUp(document, ts_parse_config_arithmetic);
});
it("parses variables", [&]() {
TSDocumentSetText(document, "x");
AssertThat(string(TSDocumentToString(document)), Equals("(expression (term (factor (variable))))"));
});
it("parses products of variables", [&]() {
TSDocumentSetText(document, "x*y");
AssertThat(string(TSDocumentToString(document)), Equals("(expression (term (factor (variable)) (3) (factor (variable))))"));
});
});
END_TEST