diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2024-05-24 19:18:11 +0000 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2024-05-24 19:18:11 +0000 |
commit | ff7ed8f586589d620a806c3758fac4a47a8e7e15 (patch) | |
tree | 729bbcb92231538fa61dab6c3d890b025484b7f5 /test/functional/legacy/excmd_spec.lua | |
parent | 376914f419eb08fdf4c1a63a77e1f035898a0f10 (diff) | |
parent | 28c04948a1c887a1cc0cb64de79fa32631700466 (diff) | |
download | rneovim-ff7ed8f586589d620a806c3758fac4a47a8e7e15.tar.gz rneovim-ff7ed8f586589d620a806c3758fac4a47a8e7e15.tar.bz2 rneovim-ff7ed8f586589d620a806c3758fac4a47a8e7e15.zip |
Merge remote-tracking branch 'upstream/master' into mix_20240309
Diffstat (limited to 'test/functional/legacy/excmd_spec.lua')
-rw-r--r-- | test/functional/legacy/excmd_spec.lua | 232 |
1 files changed, 114 insertions, 118 deletions
diff --git a/test/functional/legacy/excmd_spec.lua b/test/functional/legacy/excmd_spec.lua index 41f14c4645..de3d498f27 100644 --- a/test/functional/legacy/excmd_spec.lua +++ b/test/functional/legacy/excmd_spec.lua @@ -1,18 +1,20 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.testutil') +local n = require('test.functional.testnvim')() local Screen = require('test.functional.ui.screen') -local clear = helpers.clear -local command = helpers.command -local exec = helpers.exec -local exec_lua = helpers.exec_lua -local expect_exit = helpers.expect_exit -local feed = helpers.feed -local fn = helpers.fn -local api = helpers.api -local read_file = helpers.read_file -local source = helpers.source -local eq = helpers.eq -local write_file = helpers.write_file -local is_os = helpers.is_os + +local clear = n.clear +local command = n.command +local exec = n.exec +local exec_lua = n.exec_lua +local expect_exit = n.expect_exit +local feed = n.feed +local fn = n.fn +local api = n.api +local read_file = t.read_file +local source = n.source +local eq = t.eq +local write_file = t.write_file +local is_os = t.is_os local function sizeoflong() if not exec_lua('return pcall(require, "ffi")') then @@ -48,12 +50,6 @@ describe(':confirm command dialog', function() local function start_new() clear() screen = Screen.new(75, 20) - screen:set_default_attr_ids({ - [0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText - [1] = { bold = true, reverse = true }, -- StatusLine, MsgSeparator - [2] = { reverse = true }, -- StatusLineNC - [3] = { bold = true, foreground = Screen.colors.SeaGreen }, -- MoreMsg - }) screen:attach() end @@ -76,17 +72,17 @@ describe(':confirm command dialog', function() feed(':confirm qall\n') screen:expect([[ bar2 | - {0:~ }|*5 + {1:~ }|*5 {2:Xbar [+] }| foo2 | - {0:~ }|*4 + {1:~ }|*4 {2:Xfoo [+] }| | - {0:~ }|*2 - {1: }| + {1:~ }|*2 + {3: }| :confirm qall | - {3:Save changes to "Xbar"?} | - {3:[Y]es, (N)o, Save (A)ll, (D)iscard All, (C)ancel: }^ | + {6:Save changes to "Xbar"?} | + {6:[Y]es, (N)o, Save (A)ll, (D)iscard All, (C)ancel: }^ | ]]) expect_exit(1000, feed, 'A') @@ -106,17 +102,17 @@ describe(':confirm command dialog', function() feed(':confirm qall\n') screen:expect([[ bar3 | - {0:~ }|*5 + {1:~ }|*5 {2:Xbar [+] }| foo3 | - {0:~ }|*4 + {1:~ }|*4 {2:Xfoo [+] }| | - {0:~ }|*2 - {1: }| + {1:~ }|*2 + {3: }| :confirm qall | - {3:Save changes to "Xbar"?} | - {3:[Y]es, (N)o, Save (A)ll, (D)iscard All, (C)ancel: }^ | + {6:Save changes to "Xbar"?} | + {6:[Y]es, (N)o, Save (A)ll, (D)iscard All, (C)ancel: }^ | ]]) expect_exit(1000, feed, 'D') @@ -136,33 +132,33 @@ describe(':confirm command dialog', function() feed(':confirm qall\n') screen:expect([[ bar4 | - {0:~ }|*5 + {1:~ }|*5 {2:Xbar [+] }| foo4 | - {0:~ }|*4 + {1:~ }|*4 {2:Xfoo [+] }| | - {0:~ }|*2 - {1: }| + {1:~ }|*2 + {3: }| :confirm qall | - {3:Save changes to "Xbar"?} | - {3:[Y]es, (N)o, Save (A)ll, (D)iscard All, (C)ancel: }^ | + {6:Save changes to "Xbar"?} | + {6:[Y]es, (N)o, Save (A)ll, (D)iscard All, (C)ancel: }^ | ]]) feed('N') screen:expect([[ bar4 | - {0:~ }|*5 + {1:~ }|*5 {2:Xbar [+] }| foo4 | - {0:~ }|*4 + {1:~ }|*4 {2:Xfoo [+] }| | - {1: }| + {3: }| :confirm qall | - {3:Save changes to "Xbar"?} | + {6:Save changes to "Xbar"?} | | - {3:Save changes to "Xfoo"?} | - {3:[Y]es, (N)o, (C)ancel: }^ | + {6:Save changes to "Xfoo"?} | + {6:[Y]es, (N)o, (C)ancel: }^ | ]]) expect_exit(1000, feed, 'Y') @@ -186,39 +182,39 @@ describe(':confirm command dialog', function() feed(':confirm close\n') screen:expect([[ abc | - {0:~ }|*3 - {1:[No Name] [+] }| + {1:~ }|*3 + {3:[No Name] [+] }| | - {1: }| + {3: }| :confirm close | - {3:Save changes to "Untitled"?} | - {3:[Y]es, (N)o, (C)ancel: }^ | + {6:Save changes to "Untitled"?} | + {6:[Y]es, (N)o, (C)ancel: }^ | ]]) feed('C') screen:expect([[ ^abc | - {0:~ }|*3 - {1:[No Name] [+] }| + {1:~ }|*3 + {3:[No Name] [+] }| | - {0:~ }|*2 + {1:~ }|*2 {2:[No Name] }| | ]]) feed(':confirm close\n') screen:expect([[ abc | - {0:~ }|*3 - {1:[No Name] [+] }| + {1:~ }|*3 + {3:[No Name] [+] }| | - {1: }| + {3: }| :confirm close | - {3:Save changes to "Untitled"?} | - {3:[Y]es, (N)o, (C)ancel: }^ | + {6:Save changes to "Untitled"?} | + {6:[Y]es, (N)o, (C)ancel: }^ | ]]) feed('N') screen:expect([[ ^ | - {0:~ }|*8 + {1:~ }|*8 | ]]) end) @@ -237,16 +233,16 @@ describe(':confirm command dialog', function() feed(':confirm q\n') screen:expect([[ foo | - {0:~ }|*3 - {1: }| + {1:~ }|*3 + {3: }| :confirm q | - {3:Save changes to "Untitled"?} | - {3:[Y]es, (N)o, (C)ancel: }^ | + {6:Save changes to "Untitled"?} | + {6:[Y]es, (N)o, (C)ancel: }^ | ]]) feed('C') screen:expect([[ ^abc | - {0:~ }|*6 + {1:~ }|*6 | ]]) @@ -254,16 +250,16 @@ describe(':confirm command dialog', function() feed(':confirm wq\n') screen:expect([[ foo | - {0:~ }|*3 - {1: }| + {1:~ }|*3 + {3: }| "Xfoo" [noeol] 1L, 3B written | - {3:Save changes to "Untitled"?} | - {3:[Y]es, (N)o, (C)ancel: }^ | + {6:Save changes to "Untitled"?} | + {6:[Y]es, (N)o, (C)ancel: }^ | ]]) feed('C') screen:expect([[ ^abc | - {0:~ }|*6 + {1:~ }|*6 "Xfoo" [noeol] 1L, 3B written | ]]) @@ -286,17 +282,17 @@ describe(':confirm command dialog', function() feed(':set ro | confirm w\n') screen:expect([[ foobar | - {0:~ }|*2 - {1: }| + {1:~ }|*2 + {3: }| :set ro | confirm w | - {3:'readonly' option is set for "Xconfirm_write_ro".} | - {3:Do you wish to write anyway?} | - {3:(Y)es, [N]o: }^ | + {6:'readonly' option is set for "Xconfirm_write_ro".} | + {6:Do you wish to write anyway?} | + {6:(Y)es, [N]o: }^ | ]]) feed('N') screen:expect([[ fooba^r | - {0:~ }|*5 + {1:~ }|*5 | 1,6 All | ]]) @@ -305,35 +301,35 @@ describe(':confirm command dialog', function() feed(':confirm w\n') screen:expect([[ foobar | - {0:~ }|*2 - {1: }| + {1:~ }|*2 + {3: }| :confirm w | - {3:'readonly' option is set for "Xconfirm_write_ro".} | - {3:Do you wish to write anyway?} | - {3:(Y)es, [N]o: }^ | + {6:'readonly' option is set for "Xconfirm_write_ro".} | + {6:Do you wish to write anyway?} | + {6:(Y)es, [N]o: }^ | ]]) feed('Y') if is_os('win') then screen:expect([[ foobar | - {0:~ }| - {1: }| + {1:~ }| + {3: }| :confirm w | - {3:'readonly' option is set for "Xconfirm_write_ro".} | - {3:Do you wish to write anyway?} | + {6:'readonly' option is set for "Xconfirm_write_ro".} | + {6:Do you wish to write anyway?} | "Xconfirm_write_ro" [unix] 1L, 7B written | - {3:Press ENTER or type command to continue}^ | + {6:Press ENTER or type command to continue}^ | ]]) else screen:expect([[ foobar | - {0:~ }| - {1: }| + {1:~ }| + {3: }| :confirm w | - {3:'readonly' option is set for "Xconfirm_write_ro".} | - {3:Do you wish to write anyway?} | + {6:'readonly' option is set for "Xconfirm_write_ro".} | + {6:Do you wish to write anyway?} | "Xconfirm_write_ro" 1L, 7B written | - {3:Press ENTER or type command to continue}^ | + {6:Press ENTER or type command to continue}^ | ]]) end eq('foobar\n', read_file('Xconfirm_write_ro')) @@ -344,36 +340,36 @@ describe(':confirm command dialog', function() feed(':set noro | silent undo | confirm w\n') screen:expect([[ foobar | - {0:~ }| - {1: }| + {1:~ }| + {3: }| :set noro | silent undo | confirm w | - {3:File permissions of "Xconfirm_write_ro" are read-only.} | - {3:It may still be possible to write it.} | - {3:Do you wish to try?} | - {3:(Y)es, [N]o: }^ | + {6:File permissions of "Xconfirm_write_ro" are read-only.} | + {6:It may still be possible to write it.} | + {6:Do you wish to try?} | + {6:(Y)es, [N]o: }^ | ]]) feed('Y') if is_os('win') then screen:expect([[ foobar | - {1: }| + {3: }| :set noro | silent undo | confirm w | - {3:File permissions of "Xconfirm_write_ro" are read-only.} | - {3:It may still be possible to write it.} | - {3:Do you wish to try?} | + {6:File permissions of "Xconfirm_write_ro" are read-only.} | + {6:It may still be possible to write it.} | + {6:Do you wish to try?} | "Xconfirm_write_ro" [unix] 1L, 4B written | - {3:Press ENTER or type command to continue}^ | + {6:Press ENTER or type command to continue}^ | ]]) else screen:expect([[ foobar | - {1: }| + {3: }| :set noro | silent undo | confirm w | - {3:File permissions of "Xconfirm_write_ro" are read-only.} | - {3:It may still be possible to write it.} | - {3:Do you wish to try?} | + {6:File permissions of "Xconfirm_write_ro" are read-only.} | + {6:It may still be possible to write it.} | + {6:Do you wish to try?} | "Xconfirm_write_ro" 1L, 4B written | - {3:Press ENTER or type command to continue}^ | + {6:Press ENTER or type command to continue}^ | ]]) end eq('foo\n', read_file('Xconfirm_write_ro')) @@ -399,10 +395,10 @@ describe(':confirm command dialog', function() b | c | d | - {1: }| + {3: }| :confirm 2,3w | - {3:Write partial file?} | - {3:(Y)es, [N]o: }^ | + {6:Write partial file?} | + {6:(Y)es, [N]o: }^ | ]]) feed('N') screen:expect([[ @@ -410,7 +406,7 @@ describe(':confirm command dialog', function() b | c | d | - {0:~ }|*2 + {1:~ }|*2 | 1,1 All | ]]) @@ -423,10 +419,10 @@ describe(':confirm command dialog', function() b | c | d | - {1: }| + {3: }| :confirm 2,3w | - {3:Write partial file?} | - {3:(Y)es, [N]o: }^ | + {6:Write partial file?} | + {6:(Y)es, [N]o: }^ | ]]) feed('Y') if is_os('win') then @@ -434,22 +430,22 @@ describe(':confirm command dialog', function() a | b | c | - {1: }| + {3: }| :confirm 2,3w | - {3:Write partial file?} | + {6:Write partial file?} | "Xwrite_partial" [New][unix] 2L, 4B written | - {3:Press ENTER or type command to continue}^ | + {6:Press ENTER or type command to continue}^ | ]]) else screen:expect([[ a | b | c | - {1: }| + {3: }| :confirm 2,3w | - {3:Write partial file?} | + {6:Write partial file?} | "Xwrite_partial" [New] 2L, 4B written | - {3:Press ENTER or type command to continue}^ | + {6:Press ENTER or type command to continue}^ | ]]) end eq('b\nc\n', read_file('Xwrite_partial')) |