Fix size calculation for error nodes

This commit is contained in:
Max Brunsfeld 2014-08-29 13:22:03 -07:00
parent 604b149c4b
commit c5ac02c571
3 changed files with 107 additions and 54 deletions

View file

@ -152,28 +152,6 @@ describe("Node", []() {
ts_node_release(node);
});
});
describe("error nodes", [&]() {
before_each([&]() {
ts_document_set_input_string(document, " [123, total nonsense, true]");
AssertThat(ts_node_string(ts_document_root_node(document)), Equals(
"(DOCUMENT (array (number) (ERROR 'o') (true)))"));
root = ts_document_root_node(document);
});
it("computes their size and position correctly", [&]() {
TSNode *array = ts_node_child(root, 0);
TSNode *error = ts_node_child(array, 1);
AssertThat(ts_node_name(error), Equals("error"));
AssertThat(ts_node_pos(error), Equals(string(" [123,").length()))
AssertThat(ts_node_size(error), Equals(string(" total nonsense").length()))
ts_node_release(array);
ts_node_release(error);
});
});
});
END_TEST