aboutsummaryrefslogtreecommitdiff
path: root/test/functional/eval/setpos_spec.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2021-09-17 09:16:40 -0700
committerGitHub <noreply@github.com>2021-09-17 09:16:40 -0700
commitd8de4eb685e35646c7d541e9a75bdc296127b7e2 (patch)
tree4bb05ec713856715ac9ba57e5d116eed344511b9 /test/functional/eval/setpos_spec.lua
parentd56002f7b722facd97b0958e141c8ed2d01495f7 (diff)
downloadrneovim-d8de4eb685e35646c7d541e9a75bdc296127b7e2.tar.gz
rneovim-d8de4eb685e35646c7d541e9a75bdc296127b7e2.tar.bz2
rneovim-d8de4eb685e35646c7d541e9a75bdc296127b7e2.zip
test: reorg #15698
Problem: Subdirectories like "visual", "insert", "normal" encourage people to separate *related* tests for no good reason. Typically the _mode_ is not the relevant topic of a test (and when it is, _then_ create an appropriate describe() or it()). Solution: - Delete the various `test/functional/<mode>/` subdirectories, move their tests to more meaningful topics. - Rename `…/normal/` to `…/editor/`. - Move or merge `…/visual/*` and `…/insert/*` tests into here where appropriate. - Rename `…/eval/` to `…/vimscript/`. - Move `…/viml/*` into here also. * test(reorg): insert/* => editor/mode_insert_spec.lua * test(reorg): cmdline/* => editor/mode_cmdline_spec.lua * test(reorg): eval core tests => eval_spec.lua
Diffstat (limited to 'test/functional/eval/setpos_spec.lua')
-rw-r--r--test/functional/eval/setpos_spec.lua64
1 files changed, 0 insertions, 64 deletions
diff --git a/test/functional/eval/setpos_spec.lua b/test/functional/eval/setpos_spec.lua
deleted file mode 100644
index 935f387bcc..0000000000
--- a/test/functional/eval/setpos_spec.lua
+++ /dev/null
@@ -1,64 +0,0 @@
-local helpers = require('test.functional.helpers')(after_each)
-local setpos = helpers.funcs.setpos
-local getpos = helpers.funcs.getpos
-local insert = helpers.insert
-local clear = helpers.clear
-local command = helpers.command
-local eval = helpers.eval
-local eq = helpers.eq
-local exc_exec = helpers.exc_exec
-
-
-describe('setpos() function', function()
- before_each(function()
- clear()
- insert([[
- First line of text
- Second line of text
- Third line of text]])
- command('new')
- insert([[
- Line of text 1
- Line of text 2
- Line of text 3]])
- end)
- it('can set the current cursor position', function()
- setpos(".", {0, 2, 1, 0})
- eq(getpos("."), {0, 2, 1, 0})
- setpos(".", {2, 1, 1, 0})
- eq(getpos("."), {0, 1, 1, 0})
- local ret = exc_exec('call setpos(".", [1, 1, 1, 0])')
- eq(0, ret)
- end)
- it('can set lowercase marks in the current buffer', function()
- setpos("'d", {0, 2, 1, 0})
- eq(getpos("'d"), {0, 2, 1, 0})
- command('undo')
- command('call setpos("\'d", [2, 3, 1, 0])')
- eq(getpos("'d"), {0, 3, 1, 0})
- end)
- it('can set lowercase marks in other buffers', function()
- local retval = setpos("'d", {1, 2, 1, 0})
- eq(0, retval)
- setpos("'d", {1, 2, 1, 0})
- eq(getpos("'d"), {0, 0, 0, 0})
- command('wincmd w')
- eq(eval('bufnr("%")'), 1)
- eq(getpos("'d"), {0, 2, 1, 0})
- end)
- it("fails when setting a mark in a buffer that doesn't exist", function()
- local retval = setpos("'d", {3, 2, 1, 0})
- eq(-1, retval)
- eq(getpos("'d"), {0, 0, 0, 0})
- retval = setpos("'D", {3, 2, 1, 0})
- eq(-1, retval)
- eq(getpos("'D"), {0, 0, 0, 0})
- end)
- it('can set uppercase marks', function()
- setpos("'D", {2, 2, 3, 0})
- eq(getpos("'D"), {2, 2, 3, 0})
- -- Can set a mark in another buffer
- setpos("'D", {1, 2, 2, 0})
- eq(getpos("'D"), {1, 2, 2, 0})
- end)
-end)