mirror of
https://github.com/tree-sitter/tree-sitter.git
synced 2026-09-13 17:06:26 -04:00
27 lines
739 B
C++
27 lines
739 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 (number)) (factor (number)))"));
|
|
});
|
|
});
|
|
|
|
END_TEST |