Skip to content

Commit dce0476

Browse files
committed
test: remove duplicate and move text actions from ts tests to own file
1 parent 457093c commit dce0476

File tree

2 files changed

+17
-31
lines changed

2 files changed

+17
-31
lines changed

tests/test_text_actions.lua

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,31 @@ local get_lines = function()
2525
return child.api.nvim_buf_get_lines(0, 0, -1, true)
2626
end
2727

28-
T["text_actions"] = MiniTest.new_set({
29-
n_retry = 3,
28+
T["f-string"] = MiniTest.new_set({
3029
hooks = {
3130
pre_case = function()
3231
child.cmd("e _not_existing_new_buffer.py")
32+
child.type_keys("cc", [["TEST"]], "<Esc>", "0")
3333
end,
3434
},
3535
})
3636

37-
T["text_actions"]["insert_f_string"] = function()
38-
child.type_keys("i", [[print("{foo}")]], "<left><esc>")
37+
T["f-string"]["insert f string"] = function()
38+
child.cmd("e! _not_existing_new_buffer.py")
39+
child.type_keys("cc", [["{foo}"]], "<Esc>", "hh", "i", "<Esc>")
40+
eq(get_lines(), { [[f"{foo}"]] })
41+
end
42+
43+
T["f-string"]["skip on r"] = function()
44+
child.cmd("e! _not_existing_new_buffer.py")
45+
child.type_keys("cc", [[r"{foo}"]], "<Esc>", "hh", "i", "<Esc>")
46+
eq(get_lines(), { [[r"{foo}"]] })
47+
end
3948

40-
eq(get_lines(), { [[print(f"{foo}")]] })
49+
T["f-string"]["skip on format"] = function()
50+
child.cmd("e! _not_existing_new_buffer.py")
51+
child.type_keys("cc", [["{foo}".format()]], "<Esc>", "0lll", "i", "<Esc>")
52+
eq(get_lines(), { [["{foo}".format()]] })
4153
end
4254

4355
-- Return test set which will be collected and execute inside `MiniTest.run()`

tests/test_treesitter.lua

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -63,31 +63,5 @@ T["enumerate"] = function()
6363
eq(get_lines(), { "for idx, i in enumerate([1, 2, 3]):" })
6464
end
6565

66-
T["f-string"] = MiniTest.new_set({
67-
hooks = {
68-
pre_case = function()
69-
child.cmd("e _not_existing_new_buffer.py")
70-
child.type_keys("cc", [["TEST"]], "<Esc>", "0")
71-
end,
72-
},
73-
})
74-
75-
T["f-string"]["insert f string"] = function()
76-
child.cmd("e! _not_existing_new_buffer.py")
77-
child.type_keys("cc", [["{foo}"]], "<Esc>", "hh", "i", "<Esc>")
78-
eq(get_lines(), { [[f"{foo}"]] })
79-
end
80-
81-
T["f-string"]["skip on r"] = function()
82-
child.cmd("e! _not_existing_new_buffer.py")
83-
child.type_keys("cc", [[r"{foo}"]], "<Esc>", "hh", "i", "<Esc>")
84-
eq(get_lines(), { [[r"{foo}"]] })
85-
end
86-
87-
T["f-string"]["skip on format"] = function()
88-
child.cmd("e! _not_existing_new_buffer.py")
89-
child.type_keys("cc", [["{foo}".format()]], "<Esc>", "0lll", "i", "<Esc>")
90-
eq(get_lines(), { [["{foo}".format()]] })
91-
end
9266
-- Return test set which will be collected and execute inside `MiniTest.run()`
9367
return T

0 commit comments

Comments
 (0)