Allow creating a tree cursor starting at any node, not just the root

Co-Authored-By: Ashi Krishnan <queerviolet@github.com>
This commit is contained in:
Max Brunsfeld 2018-06-21 12:54:04 -07:00
parent 35ed21139c
commit 89b6a14d9f
5 changed files with 27 additions and 15 deletions

View file

@ -556,7 +556,7 @@ describe("TreeCursor", [&]() {
parser = ts_parser_new();
ts_parser_set_language(parser, load_real_language("json"));
tree = ts_parser_parse_string(parser, nullptr, json_string.c_str(), json_string.size());
cursor = ts_tree_cursor_new(tree);
cursor = ts_tree_cursor_new(ts_tree_root_node(tree));
});
after_each([&]() {
@ -728,7 +728,7 @@ describe("TreeCursor", [&]() {
ts_tree_delete(tree);
tree = ts_parser_parse_string(parser, nullptr, "b ... b ... c", 13);
cursor = ts_tree_cursor_new(tree);
cursor = ts_tree_cursor_new(ts_tree_root_node(tree));
TSNode node = ts_tree_cursor_current_node(&cursor);
AssertThat(ts_node_type(node), Equals("a"));