summaryrefslogtreecommitdiff
path: root/src/testdir/test_tab.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-10-26 20:21:44 +0200
committerBram Moolenaar <Bram@vim.org>2017-10-26 20:21:44 +0200
commit15993ce9210e8b8d4bc11e1d640f6447b18d3e6c (patch)
tree1c1558bba5fb9a3bd1cfa6d8d494aeca2bd83097 /src/testdir/test_tab.vim
parent235dddf1f4afe3a40047dbf2aca1bd177b7be18b (diff)
downloadvim-git-15993ce9210e8b8d4bc11e1d640f6447b18d3e6c.tar.gz
patch 8.0.1221: still too many old style testsv8.0.1221
Problem: Still too many old style tests. Solution: Convert a few more tests to new style. (Yegappan Lakshmanan, closes #2256)
Diffstat (limited to 'src/testdir/test_tab.vim')
-rw-r--r--src/testdir/test_tab.vim45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/testdir/test_tab.vim b/src/testdir/test_tab.vim
new file mode 100644
index 000000000..b847dbd96
--- /dev/null
+++ b/src/testdir/test_tab.vim
@@ -0,0 +1,45 @@
+
+" Tests for "r<Tab>" with 'smarttab' and 'expandtab' set/not set.
+" Also test that dv_ works correctly
+func Test_smarttab()
+ enew!
+ set smarttab expandtab ts=8 sw=4
+ " make sure that backspace works, no matter what termcap is used
+ exe "set t_kD=\<C-V>x7f t_kb=\<C-V>x08"
+ call append(0, ['start text',
+ \ "\t\tsome test text",
+ \ 'test text',
+ \ "\t\tother test text",
+ \ ' a cde',
+ \ ' f ghi',
+ \ 'test text',
+ \ ' Second line beginning with whitespace'
+ \ ])
+ call cursor(1, 1)
+ exe "normal /some\<CR>"
+ exe "normal r\t"
+ call assert_equal("\t\t ome test text", getline('.'))
+ set noexpandtab
+ exe "normal /other\<CR>"
+ exe "normal r\t"
+ call assert_equal("\t\t ther test text", getline('.'))
+
+ " Test replacing with Tabs and then backspacing to undo it
+ exe "normal j0wR\t\t\t\<BS>\<BS>\<BS>"
+ call assert_equal(" a cde", getline('.'))
+ " Test replacing with Tabs
+ exe "normal j0wR\t\t\t"
+ call assert_equal(" \t\thi", getline('.'))
+
+ " Test that copyindent works with expandtab set
+ set expandtab smartindent copyindent ts=8 sw=8 sts=8
+ exe "normal jo{\<CR>x"
+ call assert_equal('{', getline(line('.') - 1))
+ call assert_equal(' x', getline('.'))
+ set nosol
+ exe "normal /Second line/\<CR>"
+ exe "normal fwdv_"
+ call assert_equal(' with whitespace', getline('.'))
+ enew!
+ set expandtab& smartindent& copyindent& ts& sw& sts&
+endfunc