feat: improve indent module

get_node_at_line should return appropriate child if available
This commit is contained in:
Munif Tanjim 2022-01-17 04:44:01 +06:00 committed by Christian Clason
parent f048886f82
commit baf94219aa
5 changed files with 38 additions and 11 deletions

View file

@ -26,8 +26,8 @@ describe("indent Python:", function()
run:new_line("basic_blocks.py", { on_line = 1, text = "wait,", indent = 4 })
run:new_line("basic_blocks.py", { on_line = 6, text = "x += 1", indent = 4 })
run:new_line("basic_blocks.py", { on_line = 10, text = "x += 1", indent = 8 })
run:new_line("basic_blocks.py", { on_line = 7, text = "x += 1", indent = 4 }, "7, after last line of a block")
run:new_line("basic_blocks.py", { on_line = 11, text = "x += 1", indent = 8 }, "11, after last line of a block")
run:new_line("basic_blocks.py", { on_line = 7, text = "x += 1", indent = 0 })
run:new_line("basic_blocks.py", { on_line = 11, text = "x += 1", indent = 4 })
run:new_line("basic_collections.py", { on_line = 3, text = "4,", indent = 4 })
run:new_line("comprehensions.py", { on_line = 8, text = "if x != 2", indent = 4 })
run:new_line("control_flow.py", { on_line = 23, text = "x = 4", indent = 4 }, "expected failure", XFAIL)