robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

Justin M. KeyesMerge #40865 from justinmk/fixcif907614088

master
1.6 KiB60 linesraw
1-- Tests for "r<Tab>" with 'smarttab' and 'expandtab' set/not set.
2-- Also test that dv_ works correctly
3
4local n = require('test.functional.testnvim')()
5local t = require('test.testutil')
6
7local describe, it, setup = t.describe, t.it, t.setup
8local feed, insert = n.feed, n.insert
9local clear, feed_command, expect = n.clear, n.feed_command, n.expect
10
11describe([[performing "r<Tab>" with 'smarttab' and 'expandtab' set/not set, and "dv_"]], function()
12  setup(clear)
13
14  -- luacheck: ignore 621 (Indentation)
15  it('is working', function()
16    insert([[
17      start text
18      		some test text
19      test text
20      		other test text
21          a cde
22          f ghi
23      test text
24        Second line beginning with whitespace]])
25
26    feed_command('set smarttab expandtab ts=8 sw=4')
27    -- Make sure that backspace works, no matter what termcap is used.
28    feed_command('set t_kD=x7f t_kb=x08')
29
30    feed_command('/some')
31    feed('r	')
32    feed_command('set noexpandtab')
33    feed_command('/other')
34    feed('r	<cr>')
35    -- Test replacing with Tabs and then backspacing to undo it.
36    feed('0wR			<bs><bs><bs><esc><cr>')
37    -- Test replacing with Tabs.
38    feed('0wR			<esc><cr>')
39    -- Test that copyindent works with expandtab set.
40    feed_command('set expandtab smartindent copyindent ts=8 sw=8 sts=8')
41    feed('o{<cr>x<esc>')
42    feed_command('set nosol')
43    feed_command('/Second line/')
44    -- Test "dv_"
45    feed('fwdv_')
46
47    -- Assert buffer contents.
48    expect([[
49      start text
50      		    ome test text
51      test text
52      		    ther test text
53          a cde
54          		hi
55      test text
56      {
57              x
58        with whitespace]])
59  end)
60end)