diff options
author | Thomas Vigouroux <tomvig38@gmail.com> | 2020-12-06 23:27:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-06 23:27:38 +0100 |
commit | 5855a3ea7bf19fdf8d1c0351ce062386fb98127a (patch) | |
tree | c74ce2405e3ab5a45817bdf648b72a1526e0c154 /test/functional/lua/treesitter_spec.lua | |
parent | 53e9adedddb24e2f3882365a6253cecd2171321a (diff) | |
parent | 2985c17867bec5dfdc77f1bae123b50cac533f1b (diff) | |
download | rneovim-5855a3ea7bf19fdf8d1c0351ce062386fb98127a.tar.gz rneovim-5855a3ea7bf19fdf8d1c0351ce062386fb98127a.tar.bz2 rneovim-5855a3ea7bf19fdf8d1c0351ce062386fb98127a.zip |
Merge pull request #13449 from nvim-treesitter/fix-language-for-range
fix(treesitter): incorrect method name call
Diffstat (limited to 'test/functional/lua/treesitter_spec.lua')
-rw-r--r-- | test/functional/lua/treesitter_spec.lua | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/functional/lua/treesitter_spec.lua b/test/functional/lua/treesitter_spec.lua index 65dc1b3e03..0e823426ae 100644 --- a/test/functional/lua/treesitter_spec.lua +++ b/test/functional/lua/treesitter_spec.lua @@ -919,4 +919,25 @@ local hl_query = [[ end) end) + describe("when getting the language for a range", function() + before_each(function() + insert([[ +int x = INT_MAX; +#define VALUE 123456789 + ]]) + end) + + it("should return the correct language tree", function() + local result = exec_lua([[ + parser = vim.treesitter.get_parser(0, "c", { + queries = { c = "(preproc_def (preproc_arg) @c)"}}) + + local sub_tree = parser:language_for_range({1, 18, 1, 19}) + + return sub_tree == parser:children().c + ]]) + + eq(result, true) + end) + end) end) |