@@ -253,21 +253,42 @@ describe("Swapping in a lua test file:", function()
253
253
assert .same (' { "<CMD>Treewalker SwapUp<CR>", "k", { desc = "up" } },' , lines .get_line (102 ))
254
254
end )
255
255
256
- it (" follows lateral swaps across rows (like in these it args)" , function ()
256
+ it (" follows right swaps across rows (like in these it args)" , function ()
257
257
vim .fn .cursor (21 , 13 )
258
258
tw .swap_right ()
259
259
assert .same (' it(function()' , lines .get_line (21 ))
260
260
assert .same (' end, "moves up and down at the same pace")' , lines .get_line (39 ))
261
261
helpers .assert_cursor_at (39 , 10 )
262
262
end )
263
263
264
- it (" follows lateral swaps across rows (like in these it args)" , function ()
264
+ it (" follows left swaps across rows (like in these it args)" , function ()
265
265
vim .fn .cursor (50 , 13 ) -- go|es
266
266
tw .swap_left ()
267
267
assert .same (' it("goes into functions eagerly", function()' , lines .get_line (41 ))
268
268
assert .same (' end)' , lines .get_line (50 ))
269
269
helpers .assert_cursor_at (41 , 8 )
270
270
end )
271
+
272
+ it (" swaps it blocks down" , function ()
273
+ assert .same (' it("one", function()' , lines .get_line (67 ))
274
+ assert .same (' it("two", function()' , lines .get_line (87 ))
275
+ vim .fn .cursor (67 , 5 ) -- |it "one"
276
+ tw .swap_down ()
277
+ assert .same (' it("two", function()' , lines .get_line (67 ))
278
+ assert .same (' it("one", function()' , lines .get_line (77 ))
279
+ helpers .assert_cursor_at (77 , 5 )
280
+ end )
281
+
282
+ it (" swaps it blocks up" , function ()
283
+ assert .same (' it("one", function()' , lines .get_line (67 ))
284
+ assert .same (' it("two", function()' , lines .get_line (87 ))
285
+ vim .fn .cursor (87 , 5 ) -- |it "two"
286
+ tw .swap_up ()
287
+ assert .same (' it("two", function()' , lines .get_line (67 ))
288
+ assert .same (' it("one", function()' , lines .get_line (77 ))
289
+ helpers .assert_cursor_at (67 , 5 )
290
+ end )
291
+
271
292
end )
272
293
273
294
-- doesn't work at all in md, doesn't need to
0 commit comments