diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2015-03-16 10:55:21 -0400 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2015-03-16 10:55:21 -0400 |
commit | 3946810d54289bd592f39b0d79d30c65b08cf82b (patch) | |
tree | c5777db2cb193b29510cb6830b508032f269f4c8 /test | |
parent | f6d4bfd51bb68d84bfc265fa973ea75978ecf304 (diff) | |
parent | 6511c24af8fa44b51690f1456f4d8ada04783886 (diff) | |
download | rneovim-3946810d54289bd592f39b0d79d30c65b08cf82b.tar.gz rneovim-3946810d54289bd592f39b0d79d30c65b08cf82b.tar.bz2 rneovim-3946810d54289bd592f39b0d79d30c65b08cf82b.zip |
Merge #2074 'Migrate legacy test 19 and 89'
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/legacy/019_smarttab_expandtab_spec.lua | 56 | ||||
-rw-r--r-- | test/functional/legacy/089_number_relnumber_findfile_spec.lua | 116 |
2 files changed, 172 insertions, 0 deletions
diff --git a/test/functional/legacy/019_smarttab_expandtab_spec.lua b/test/functional/legacy/019_smarttab_expandtab_spec.lua new file mode 100644 index 0000000000..a33bd0c3ae --- /dev/null +++ b/test/functional/legacy/019_smarttab_expandtab_spec.lua @@ -0,0 +1,56 @@ +-- Tests for "r<Tab>" with 'smarttab' and 'expandtab' set/not set. +-- Also test that dv_ works correctly + +local helpers = require('test.functional.helpers') +local feed, insert = helpers.feed, helpers.insert +local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect + +describe([[performing "r<Tab>" with 'smarttab' and 'expandtab' set/not set, and "dv_"]], function() + setup(clear) + + it('is working', function() + insert([[ + start text + some test text + test text + other test text + a cde + f ghi + test text + Second line beginning with whitespace]]) + + execute('set smarttab expandtab ts=8 sw=4') + -- Make sure that backspace works, no matter what termcap is used. + execute('set t_kD=x7f t_kb=x08') + + execute('/some') + feed('r ') + execute('set noexpandtab') + execute('/other') + feed('r <cr>') + -- Test replacing with Tabs and then backspacing to undo it. + feed('0wR <bs><bs><bs><esc><cr>') + -- Test replacing with Tabs. + feed('0wR <esc><cr>') + -- Test that copyindent works with expandtab set. + execute('set expandtab smartindent copyindent ts=8 sw=8 sts=8') + feed('o{<cr>x<esc>') + execute('set nosol') + execute('/Second line/') + -- Test "dv_" + feed('fwdv_') + + -- Assert buffer contents. + expect([[ + start text + ome test text + test text + ther test text + a cde + hi + test text + { + x + with whitespace]]) + end) +end) diff --git a/test/functional/legacy/089_number_relnumber_findfile_spec.lua b/test/functional/legacy/089_number_relnumber_findfile_spec.lua new file mode 100644 index 0000000000..1f8e49cc81 --- /dev/null +++ b/test/functional/legacy/089_number_relnumber_findfile_spec.lua @@ -0,0 +1,116 @@ +-- - Some tests for setting 'number' and 'relativenumber' +-- This is not all that useful now that the options are no longer reset when +-- setting the other. + +local helpers = require('test.functional.helpers') +local feed = helpers.feed +local clear, execute, expect, source = helpers.clear, helpers.execute, helpers.expect, helpers.source + +describe("setting 'number' and 'relativenumber'", function() + setup(clear) + + it('is working', function() + source([[ + set hidden nu rnu + redir @a | set nu? | set rnu? | redir END + e! xx + redir @b | set nu? | set rnu? | redir END + e! # + $put ='results:' + $put a + $put b + + set nonu nornu + setglobal nu + setlocal rnu + redir @c | setglobal nu? | redir END + set nonu nornu + setglobal rnu + setlocal nu + redir @d | setglobal rnu? | redir END + $put =':setlocal must NOT reset the other global value' + $put c + $put d + + set nonu nornu + setglobal nu + setglobal rnu + redir @e | setglobal nu? | redir END + set nonu nornu + setglobal rnu + setglobal nu + redir @f | setglobal rnu? | redir END + $put =':setglobal MUST reset the other global value' + $put e + $put f + + set nonu nornu + set nu + set rnu + redir @g | setglobal nu? | redir END + set nonu nornu + set rnu + set nu + redir @h | setglobal rnu? | redir END + $put =':set MUST reset the other global value' + $put g + $put h + ]]) + + -- Remove empty line + feed('ggdd') + + -- Assert buffer contents. + expect([[ + results: + + number + relativenumber + + number + relativenumber + :setlocal must NOT reset the other global value + + number + + relativenumber + :setglobal MUST reset the other global value + + number + + relativenumber + :set MUST reset the other global value + + number + + relativenumber]]) + end) +end) + +-- - Some tests for findfile() function +describe('findfile', function() + setup(clear) + + it('is working', function() + -- Assume test is being run from project root + source([[ + $put ='Testing findfile' + $put ='' + set ssl + $put =findfile('vim.c','src/nvim/ap*') + cd src/nvim + $put =findfile('vim.c','ap*') + $put =findfile('vim.c','api') + ]]) + + -- Remove empty line + feed('ggdd') + + expect([[ + Testing findfile + + src/nvim/api/vim.c + api/vim.c + api/vim.c]]) + end) +end) |