mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
tests: Migrate legacy test 31 #2736
This commit is contained in:
parent
d9f97e3026
commit
8ce22c6323
@ -15,7 +15,7 @@ SCRIPTS := test_autoformat_join.out \
|
|||||||
test17.out \
|
test17.out \
|
||||||
test24.out \
|
test24.out \
|
||||||
test26.out test27.out test29.out test30.out \
|
test26.out test27.out test29.out test30.out \
|
||||||
test31.out test32.out test34.out \
|
test32.out test34.out \
|
||||||
test36.out test37.out test39.out test40.out \
|
test36.out test37.out test39.out test40.out \
|
||||||
test42.out test43.out test45.out \
|
test42.out test43.out test45.out \
|
||||||
test46.out test47.out test48.out test49.out \
|
test46.out test47.out test48.out test49.out \
|
||||||
|
@ -1,75 +0,0 @@
|
|||||||
Test for commands that close windows and/or buffers:
|
|
||||||
:quit
|
|
||||||
:close
|
|
||||||
:hide
|
|
||||||
:only
|
|
||||||
:sall
|
|
||||||
:all
|
|
||||||
:ball
|
|
||||||
:buf
|
|
||||||
:edit
|
|
||||||
|
|
||||||
STARTTEST
|
|
||||||
:so tiny.vim
|
|
||||||
GA 1:$w! Xtest1
|
|
||||||
$r2:$w! Xtest2
|
|
||||||
$r3:$w! Xtest3
|
|
||||||
:n! Xtest1 Xtest2
|
|
||||||
A 1:set hidden
|
|
||||||
:" test for working :n when hidden set; write "testtext 2"
|
|
||||||
:n
|
|
||||||
:w! test.out
|
|
||||||
:" test for failing :rew when hidden not set; write "testtext 2 2"
|
|
||||||
:set nohidden
|
|
||||||
A 2:rew
|
|
||||||
:w >>test.out
|
|
||||||
:" test for working :rew when hidden set; write "testtext 1 1"
|
|
||||||
:set hidden
|
|
||||||
:rew
|
|
||||||
:w >>test.out
|
|
||||||
:" test for :all keeping a buffer when it's modified; write "testtext 1 1 1"
|
|
||||||
:set nohidden
|
|
||||||
A 1:sp
|
|
||||||
:n Xtest2 Xtest3
|
|
||||||
:all
|
|
||||||
:1wincmd w
|
|
||||||
:w >>test.out
|
|
||||||
:" test abandoning changed buffer, should be unloaded even when 'hidden' set
|
|
||||||
:" write "testtext 2 2" twice
|
|
||||||
:set hidden
|
|
||||||
A 1:q!
|
|
||||||
:w >>test.out
|
|
||||||
:unhide
|
|
||||||
:w >>test.out
|
|
||||||
:" test ":hide" hides anyway when 'hidden' not set; write "testtext 3"
|
|
||||||
:set nohidden
|
|
||||||
A 2:hide
|
|
||||||
:w >>test.out
|
|
||||||
:" test ":edit" failing in modified buffer when 'hidden' not set
|
|
||||||
:" write "testtext 3 3"
|
|
||||||
A 3:e Xtest1
|
|
||||||
:w >>test.out
|
|
||||||
:" test ":edit" working in modified buffer when 'hidden' set; write "testtext 1"
|
|
||||||
:set hidden
|
|
||||||
:e Xtest1
|
|
||||||
:w >>test.out
|
|
||||||
:" test ":close" not hiding when 'hidden' not set in modified buffer;
|
|
||||||
:" write "testtext 3 3 3"
|
|
||||||
:sp Xtest3
|
|
||||||
:set nohidden
|
|
||||||
A 3:close
|
|
||||||
:w >>test.out
|
|
||||||
:" test ":close!" does hide when 'hidden' not set in modified buffer;
|
|
||||||
:" write "testtext 1"
|
|
||||||
A 3:close!
|
|
||||||
:w >>test.out
|
|
||||||
:set nohidden
|
|
||||||
:" test ":all!" hides changed buffer; write "testtext 2 2 2"
|
|
||||||
:sp Xtest4
|
|
||||||
GA 4:all!
|
|
||||||
:1wincmd w
|
|
||||||
:w >>test.out
|
|
||||||
:qa!
|
|
||||||
ENDTEST
|
|
||||||
|
|
||||||
testtext
|
|
@ -1,12 +0,0 @@
|
|||||||
testtext 2
|
|
||||||
testtext 2 2
|
|
||||||
testtext 1 1
|
|
||||||
testtext 1 1 1
|
|
||||||
testtext 2 2
|
|
||||||
testtext 2 2
|
|
||||||
testtext 3
|
|
||||||
testtext 3 3
|
|
||||||
testtext 1
|
|
||||||
testtext 3 3 3
|
|
||||||
testtext 1
|
|
||||||
testtext 2 2 2
|
|
94
test/functional/legacy/031_close_commands_spec.lua
Normal file
94
test/functional/legacy/031_close_commands_spec.lua
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
-- Test for commands that close windows and/or buffers
|
||||||
|
-- :quit
|
||||||
|
-- :close
|
||||||
|
-- :hide
|
||||||
|
-- :only
|
||||||
|
-- :sall
|
||||||
|
-- :all
|
||||||
|
-- :ball
|
||||||
|
-- :buf
|
||||||
|
-- :edit
|
||||||
|
|
||||||
|
local helpers = require('test.functional.helpers')
|
||||||
|
local feed, insert, source = helpers.feed, helpers.insert, helpers.source
|
||||||
|
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
|
||||||
|
|
||||||
|
describe('Commands that close windows and/or buffers', function()
|
||||||
|
setup(clear)
|
||||||
|
|
||||||
|
it('is working', function()
|
||||||
|
insert('testtext')
|
||||||
|
|
||||||
|
feed('GA 1<Esc>:$w! Xtest1<CR>')
|
||||||
|
feed('$r2:$w! Xtest2<CR>')
|
||||||
|
feed('$r3:$w! Xtest3<CR>')
|
||||||
|
execute('n! Xtest1 Xtest2')
|
||||||
|
feed('A 1<Esc>:set hidden<CR>')
|
||||||
|
|
||||||
|
-- Test for working :n when hidden set
|
||||||
|
execute('n')
|
||||||
|
expect('testtext 2')
|
||||||
|
|
||||||
|
-- Test for failing :rew when hidden not set
|
||||||
|
execute('set nohidden')
|
||||||
|
feed('A 2<Esc>:rew<CR>')
|
||||||
|
expect('testtext 2 2')
|
||||||
|
|
||||||
|
-- Test for working :rew when hidden set
|
||||||
|
execute('set hidden')
|
||||||
|
execute('rew')
|
||||||
|
expect('testtext 1 1')
|
||||||
|
|
||||||
|
-- Test for :all keeping a buffer when it's modified
|
||||||
|
execute('set nohidden')
|
||||||
|
feed('A 1<Esc>:sp<CR>')
|
||||||
|
execute('n Xtest2 Xtest3')
|
||||||
|
execute('all')
|
||||||
|
execute('1wincmd w')
|
||||||
|
expect('testtext 1 1 1')
|
||||||
|
|
||||||
|
-- Test abandoning changed buffer, should be unloaded even when 'hidden' set
|
||||||
|
execute('set hidden')
|
||||||
|
feed('A 1<Esc>:q!<CR>')
|
||||||
|
expect('testtext 2 2')
|
||||||
|
execute('unhide')
|
||||||
|
expect('testtext 2 2')
|
||||||
|
|
||||||
|
-- Test ":hide" hides anyway when 'hidden' not set
|
||||||
|
execute('set nohidden')
|
||||||
|
feed('A 2<Esc>:hide<CR>')
|
||||||
|
expect('testtext 3')
|
||||||
|
|
||||||
|
-- Test ":edit" failing in modified buffer when 'hidden' not set
|
||||||
|
feed('A 3<Esc>:e Xtest1<CR>')
|
||||||
|
expect('testtext 3 3')
|
||||||
|
|
||||||
|
-- Test ":edit" working in modified buffer when 'hidden' set
|
||||||
|
execute('set hidden')
|
||||||
|
execute('e Xtest1')
|
||||||
|
expect('testtext 1')
|
||||||
|
|
||||||
|
-- Test ":close" not hiding when 'hidden' not set in modified buffer
|
||||||
|
execute('sp Xtest3')
|
||||||
|
execute('set nohidden')
|
||||||
|
feed('A 3<Esc>:close<CR>')
|
||||||
|
expect('testtext 3 3 3')
|
||||||
|
|
||||||
|
-- Test ":close!" does hide when 'hidden' not set in modified buffer
|
||||||
|
feed('A 3<Esc>:close!<CR>')
|
||||||
|
execute('set nohidden')
|
||||||
|
expect('testtext 1')
|
||||||
|
|
||||||
|
-- Test ":all!" hides changed buffer
|
||||||
|
execute('sp Xtest4')
|
||||||
|
feed('GA 4<Esc>:all!<CR>')
|
||||||
|
execute('1wincmd w')
|
||||||
|
expect('testtext 2 2 2')
|
||||||
|
end)
|
||||||
|
|
||||||
|
teardown(function()
|
||||||
|
os.remove('Xtest1')
|
||||||
|
os.remove('Xtest2')
|
||||||
|
os.remove('Xtest3')
|
||||||
|
end)
|
||||||
|
end)
|
Loading…
Reference in New Issue
Block a user