diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-07-16 21:14:54 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-07-16 21:32:25 +0800 |
commit | bc73795a5858129a84d510f682c9dcb17aa1813a (patch) | |
tree | e046306d2b4a983e030be9a1d718c98494e289ee /test/functional/legacy/messages_spec.lua | |
parent | f7c6676199f222162dc4ec448857ac64faa26f87 (diff) | |
download | rneovim-bc73795a5858129a84d510f682c9dcb17aa1813a.tar.gz rneovim-bc73795a5858129a84d510f682c9dcb17aa1813a.tar.bz2 rneovim-bc73795a5858129a84d510f682c9dcb17aa1813a.zip |
vim-patch:8.2.0198: no tests for y/n prompt
Problem: No tests for y/n prompt.
Solution: Add tests. (Dominique Pelle, closes vim/vim#5564)
https://github.com/vim/vim/commit/43c60eda2aa22ba3d7aaf418cfbdb75f1a008e67
Diffstat (limited to 'test/functional/legacy/messages_spec.lua')
-rw-r--r-- | test/functional/legacy/messages_spec.lua | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/test/functional/legacy/messages_spec.lua b/test/functional/legacy/messages_spec.lua index 9fd6090969..2b0e6941ef 100644 --- a/test/functional/legacy/messages_spec.lua +++ b/test/functional/legacy/messages_spec.lua @@ -287,6 +287,76 @@ describe('messages', function() end) end) + -- oldtest: Test_ask_yesno() + it('y/n prompt works', function() + screen = Screen.new(75, 6) + screen:set_default_attr_ids({ + [0] = {bold = true, foreground = Screen.colors.Blue}, -- NonText + [1] = {bold = true, foreground = Screen.colors.SeaGreen}, -- MoreMsg + [2] = {bold = true, reverse = true}, -- MsgSeparator + }) + screen:attach() + command('set noincsearch nohlsearch inccommand=') + command('call setline(1, range(1, 2))') + + feed(':2,1s/^/n/\n') + screen:expect([[ + 1 | + 2 | + {0:~ }| + {0:~ }| + {0:~ }| + {1:Backwards range given, OK to swap (y/n)?}^ | + ]]) + feed('n') + screen:expect([[ + ^1 | + 2 | + {0:~ }| + {0:~ }| + {0:~ }| + {1:Backwards range given, OK to swap (y/n)?}n | + ]]) + + feed(':2,1s/^/Esc/\n') + screen:expect([[ + 1 | + 2 | + {0:~ }| + {0:~ }| + {0:~ }| + {1:Backwards range given, OK to swap (y/n)?}^ | + ]]) + feed('<Esc>') + screen:expect([[ + ^1 | + 2 | + {0:~ }| + {0:~ }| + {0:~ }| + {1:Backwards range given, OK to swap (y/n)?}n | + ]]) + + feed(':2,1s/^/y/\n') + screen:expect([[ + 1 | + 2 | + {0:~ }| + {0:~ }| + {0:~ }| + {1:Backwards range given, OK to swap (y/n)?}^ | + ]]) + feed('y') + screen:expect([[ + y1 | + ^y2 | + {0:~ }| + {0:~ }| + {0:~ }| + {1:Backwards range given, OK to swap (y/n)?}y | + ]]) + end) + -- oldtest: Test_fileinfo_after_echo() it('fileinfo does not overwrite echo message vim-patch:8.2.4156', function() screen = Screen.new(40, 6) |