diff options
| author | Christoph Sax <christoph.sax@mailbox.org> | 2023-09-13 20:54:04 +0200 |
|---|---|---|
| committer | Christian Clason <c.clason@uni-graz.at> | 2023-09-14 20:07:02 +0200 |
| commit | 5ec42175676bc4e6248b8ca9603acbc86497c68e (patch) | |
| tree | e94432a716f72782fc8205625279daac00fd1523 /tests/indent | |
| parent | Update parsers: t32, wing (diff) | |
| download | nvim-treesitter-5ec42175676bc4e6248b8ca9603acbc86497c68e.tar nvim-treesitter-5ec42175676bc4e6248b8ca9603acbc86497c68e.tar.gz nvim-treesitter-5ec42175676bc4e6248b8ca9603acbc86497c68e.tar.bz2 nvim-treesitter-5ec42175676bc4e6248b8ca9603acbc86497c68e.tar.lz nvim-treesitter-5ec42175676bc4e6248b8ca9603acbc86497c68e.tar.xz nvim-treesitter-5ec42175676bc4e6248b8ca9603acbc86497c68e.tar.zst nvim-treesitter-5ec42175676bc4e6248b8ca9603acbc86497c68e.zip | |
fix(t32): update indent queries & test
The latest release of the grammar changes the handling of consecutive
line breaks. This breaks the existing test for indents.
This commit updates the indent queries and fixes the associated test.
Diffstat (limited to 'tests/indent')
| -rw-r--r-- | tests/indent/t32/if_block.cmm | 6 | ||||
| -rw-r--r-- | tests/indent/t32_spec.lua | 39 |
2 files changed, 30 insertions, 15 deletions
diff --git a/tests/indent/t32/if_block.cmm b/tests/indent/t32/if_block.cmm index e85b5e714..4bda7c6e5 100644 --- a/tests/indent/t32/if_block.cmm +++ b/tests/indent/t32/if_block.cmm @@ -43,7 +43,7 @@ IF &f stop ELSE IF &h - ( - continue - ) + ( + continue + ) diff --git a/tests/indent/t32_spec.lua b/tests/indent/t32_spec.lua index b305cd61c..88d26612b 100644 --- a/tests/indent/t32_spec.lua +++ b/tests/indent/t32_spec.lua @@ -35,7 +35,22 @@ describe("indent t32:", function() ) end - runner:new_line("if_block.cmm", { on_line = 45, text = "&x=1.", indent = 2 }, "command in IF then") + -- Insertion of a command right before the existing block results in + -- incorrect syntax. The parse either detect an error or incorrectly + -- assumes "ELSE IF" is a command. + for ii, test in ipairs { + { 26, 2 }, + { 30, 2 }, + } do + runner:new_line( + "if_block.cmm", + { on_line = test[1], text = 'PRINT ""', indent = test[2] }, + "displace block in IF then[" .. ii .. "]", + XFAIL + ) + end + + runner:new_line("if_block.cmm", { on_line = 45, text = "&x=1.", indent = 6 }, "command in IF then", XFAIL) for ii, test in ipairs { { 16, 2 }, @@ -45,7 +60,7 @@ describe("indent t32:", function() } do runner:new_line( "if_block.cmm", - { on_line = test[1], text = "(\n", indent = test[2] }, + { on_line = test[1], text = "CONTinue\n", indent = test[2] }, "command in IF else[" .. ii .. "]" ) end @@ -68,8 +83,8 @@ describe("indent t32:", function() end for ii, test in ipairs { - { 1, 0, nil }, - { 4, 2, XFAIL }, + { 1, 0 }, + { 4, 2 }, } do runner:new_line( "repeat_block.cmm", @@ -81,9 +96,9 @@ describe("indent t32:", function() runner:new_line("repeat_block.cmm", { on_line = 3, text = "(\n", indent = 0 }, "block in RePeaT then") for ii, test in ipairs { - { 7, 2, XFAIL }, - { 18, 2, nil }, - { 24, 2, XFAIL }, + { 7, 2 }, + { 18, 2 }, + { 24, 2 }, } do runner:new_line( "repeat_block.cmm", @@ -95,11 +110,11 @@ describe("indent t32:", function() runner:new_line("subroutine_block.cmm", { on_line = 1, text = "(\n", indent = 0 }, "block after call label") for ii, test in ipairs { - { 2, 2, XFAIL }, - { 3, 2, nil }, - { 8, 2, XFAIL }, - { 12, 2, nil }, - { 19, 2, XFAIL }, + { 2, 2 }, + { 3, 2 }, + { 8, 2 }, + { 12, 2 }, + { 19, 2 }, } do runner:new_line( "subroutine_block.cmm", |
