Add a happy path test for ts_document_set_input_string_with_length
This commit is contained in:
parent
638aa87e42
commit
93e94bf4b2
1 changed files with 11 additions and 0 deletions
|
|
@ -116,6 +116,17 @@ describe("Document", [&]() {
|
|||
AssertThat(spy_input->strings_read, Equals(vector<string>({" [null, 2" })));
|
||||
});
|
||||
|
||||
it("allows setting input string with length", [&]() {
|
||||
const char content[] = { '1' };
|
||||
ts_document_set_input_string_with_length(document, content, 1);
|
||||
ts_document_parse(document);
|
||||
TSNode new_root = ts_document_root_node(document);
|
||||
AssertThat(ts_node_end_char(new_root), Equals<size_t>(1));
|
||||
assert_node_string_equals(
|
||||
new_root,
|
||||
"(number)");
|
||||
});
|
||||
|
||||
it("reads from the new input correctly when the old input was blank", [&]() {
|
||||
ts_document_set_input_string(document, "");
|
||||
ts_document_parse(document);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue