2014-10-24 08:57:06 -07:00
|
|
|
-- Tests for complicated + argument to :edit command
|
|
|
|
|
2024-04-20 08:44:13 -07:00
|
|
|
local n = require('test.functional.testnvim')()
|
|
|
|
|
|
|
|
local clear, insert = n.clear, n.insert
|
|
|
|
local command, expect = n.command, n.expect
|
|
|
|
local poke_eventloop = n.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)
|