2014-10-24 08:57:06 -07:00
|
|
|
-- Tests for complicated + argument to :edit command
|
|
|
|
|
2016-04-23 16:53:11 -07:00
|
|
|
local helpers = require('test.functional.helpers')(after_each)
|
2015-11-17 15:31:22 -07:00
|
|
|
local clear, insert = helpers.clear, helpers.insert
|
2017-04-08 14:12:26 -07:00
|
|
|
local command, expect = helpers.command, helpers.expect
|
2020-10-19 11:17:51 -07:00
|
|
|
local poke_eventloop = helpers.poke_eventloop
|
2014-10-24 08:57:06 -07:00
|
|
|
|
|
|
|
describe(':edit', function()
|
|
|
|
setup(clear)
|
|
|
|
|
|
|
|
it('is working', function()
|
|
|
|
insert([[
|
|
|
|
The result should be in Xfile1: "fooPIPEbar", in Xfile2: "fooSLASHbar"
|
|
|
|
foo|bar
|
|
|
|
foo/bar]])
|
2020-10-19 11:17:51 -07:00
|
|
|
poke_eventloop()
|
2014-10-24 08:57:06 -07:00
|
|
|
|
|
|
|
-- Prepare some test files
|
2017-04-08 14:12:26 -07:00
|
|
|
command('$-1w! Xfile1')
|
|
|
|
command('$w! Xfile2')
|
|
|
|
command('w! Xfile0')
|
2014-10-24 08:57:06 -07:00
|
|
|
|
|
|
|
-- Open Xfile using '+' range
|
2017-04-08 14:12:26 -07:00
|
|
|
command('edit +1 Xfile1')
|
|
|
|
command('s/|/PIPE/')
|
|
|
|
command('yank A')
|
|
|
|
command('w! Xfile1')
|
2014-10-24 08:57:06 -07:00
|
|
|
|
|
|
|
-- Open Xfile2 using '|' range
|
2017-04-08 14:12:26 -07:00
|
|
|
command('edit Xfile2|1')
|
|
|
|
command("s/\\//SLASH/")
|
|
|
|
command('yank A')
|
|
|
|
command('w! Xfile2')
|
2014-10-24 08:57:06 -07:00
|
|
|
|
|
|
|
-- Clean first buffer and put @a
|
2017-04-08 14:12:26 -07:00
|
|
|
command('bf')
|
|
|
|
command('%d')
|
|
|
|
command('0put a')
|
2014-10-24 08:57:06 -07:00
|
|
|
|
2014-11-06 19:54:49 -07:00
|
|
|
-- Remove empty line
|
2017-04-08 14:12:26 -07:00
|
|
|
command('$d')
|
2014-10-24 08:57:06 -07:00
|
|
|
|
|
|
|
-- The buffer should now contain
|
|
|
|
expect([[
|
|
|
|
fooPIPEbar
|
|
|
|
fooSLASHbar]])
|
|
|
|
end)
|
|
|
|
|
|
|
|
teardown(function()
|
|
|
|
os.remove('Xfile0')
|
|
|
|
os.remove('Xfile1')
|
|
|
|
os.remove('Xfile2')
|
|
|
|
end)
|
|
|
|
end)
|