diff options
author | KillTheMule <KillTheMule@users.noreply.github.com> | 2016-07-01 12:26:20 +0200 |
---|---|---|
committer | KillTheMule <KillTheMule@users.noreply.github.com> | 2016-07-01 15:25:49 +0200 |
commit | c8da12b9a6cd6060b02e06af90ea231e92724fec (patch) | |
tree | 3689732d2a6c26767c61c11223156a5c7df7920f | |
parent | ce31c21c7d7732e43cae2703a8bd54d70763cc5d (diff) | |
download | rneovim-c8da12b9a6cd6060b02e06af90ea231e92724fec.tar.gz rneovim-c8da12b9a6cd6060b02e06af90ea231e92724fec.tar.bz2 rneovim-c8da12b9a6cd6060b02e06af90ea231e92724fec.zip |
Add test for :drop
Cf. https://github.com/neovim/neovim/pull/4995
-rw-r--r-- | test/functional/ex_cmds/drop_spec.lua | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/test/functional/ex_cmds/drop_spec.lua b/test/functional/ex_cmds/drop_spec.lua new file mode 100644 index 0000000000..16b194dd7d --- /dev/null +++ b/test/functional/ex_cmds/drop_spec.lua @@ -0,0 +1,80 @@ +local helpers = require('test.functional.helpers')(after_each) +local Screen = require('test.functional.ui.screen') +local clear, feed, execute = helpers.clear, helpers.feed, helpers.execute + +describe(":drop", function() + local screen + + before_each(function() + clear() + screen = Screen.new(35, 10) + screen:attach() + screen:set_default_attr_ignore({{bold=true, foreground=Screen.colors.Blue}}) + screen:set_default_attr_ids({ + [1] = {bold = true, reverse = true}, + [2] = {reverse = true}, + [3] = {bold = true}, + }) + execute("set laststatus=2") + end) + + after_each(function() + screen:detach() + end) + + it("works like :e when called with only one window open", function() + execute("drop tmp1.vim") + screen:expect([[ + ^ | + ~ | + ~ | + ~ | + ~ | + ~ | + ~ | + ~ | + {1:tmp1.vim }| + "tmp1.vim" [New File] | + ]]) + end) + + it("switches to an open window showing the buffer", function() + execute("edit tmp1") + execute("vsplit") + execute("edit tmp2") + execute("drop tmp1") + screen:expect([[ + {2:|}^ | + ~ {2:|}~ | + ~ {2:|}~ | + ~ {2:|}~ | + ~ {2:|}~ | + ~ {2:|}~ | + ~ {2:|}~ | + ~ {2:|}~ | + {2:tmp2 }{1:tmp1 }| + :drop tmp1 | + ]]) + end) + + it("splits off a new window when a buffer can't be abandoned", function() + execute("edit tmp1") + execute("vsplit") + execute("edit tmp2") + feed("iABC<esc>") + execute("drop tmp3") + screen:expect([[ + ^ {2:|} | + ~ {2:|}~ | + ~ {2:|}~ | + ~ {2:|}~ | + {1:tmp3 }{2:|}~ | + ABC {2:|}~ | + ~ {2:|}~ | + ~ {2:|}~ | + {2:tmp2 [+] tmp1 }| + "tmp3" [New File] | + ]]) + end) + +end) |