diff --git a/spec/runtime/document_spec.cc b/spec/runtime/document_spec.cc index 52e65ffb..f80419dc 100644 --- a/spec/runtime/document_spec.cc +++ b/spec/runtime/document_spec.cc @@ -116,6 +116,17 @@ describe("Document", [&]() { AssertThat(spy_input->strings_read, Equals(vector({" [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(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);