diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2023-12-09 22:33:31 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-12-09 22:33:31 +0800 |
| commit | ec3c569dd8f646d5e9cf6365f74b89fab7c16091 (patch) | |
| tree | 5cc490afac4607008bacf24d132015b63adfd1d0 /test/functional/editor/completion_spec.lua | |
| parent | 8be24fed8ffac51aa4808786ab010e8b87070324 (diff) | |
| parent | 1037ce2e461034a20e35ad59969fd05d5ad68b91 (diff) | |
| download | rneovim-ec3c569dd8f646d5e9cf6365f74b89fab7c16091.tar.gz rneovim-ec3c569dd8f646d5e9cf6365f74b89fab7c16091.tar.bz2 rneovim-ec3c569dd8f646d5e9cf6365f74b89fab7c16091.zip | |
Merge pull request #26490 from zeertzjq/screen-repeat
test: avoid repeated screen lines in expected states
Diffstat (limited to 'test/functional/editor/completion_spec.lua')
| -rw-r--r-- | test/functional/editor/completion_spec.lua | 257 |
1 files changed, 51 insertions, 206 deletions
diff --git a/test/functional/editor/completion_spec.lua b/test/functional/editor/completion_spec.lua index 84af90a298..504943e3cc 100644 --- a/test/functional/editor/completion_spec.lua +++ b/test/functional/editor/completion_spec.lua @@ -41,22 +41,14 @@ describe('completion', function() screen:expect([[ foo | foo^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 {3:-- Keyword Local completion (^N^P) The only match} | ]]) feed('<C-e>') screen:expect([[ foo | ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 {3:-- INSERT --} | ]]) feed('<ESC>') @@ -112,10 +104,7 @@ describe('completion', function() foo^ | {2:bar foobaz baz }{0: }| {1:abbr kind menu }{0: }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 {3:-- Omni completion (^O^N^P) }{4:match 1 of 2} | ]]) eq({word = 'foo', abbr = 'bar', menu = 'baz', @@ -140,11 +129,7 @@ describe('completion', function() screen:expect([[ foo | ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 {3:-- INSERT --} | ]]) feed('<C-x>') @@ -152,11 +137,7 @@ describe('completion', function() screen:expect([[ foo | ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 {3:-- ^X mode (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)} | ]]) feed('<C-n>') @@ -164,10 +145,7 @@ describe('completion', function() foo | foo^ | {2:foo }{0: }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 {3:-- Keyword Local completion (^N^P) The only match} | ]]) feed('bar<ESC>') @@ -178,9 +156,7 @@ describe('completion', function() foobar | foo^ | {2:foo }{0: }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 {3:-- INSERT --} | ]]) eq('foo', eval('getline(3)')) @@ -192,34 +168,24 @@ describe('completion', function() foo | ^ | {2:foo }{0: }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 {3:-- Keyword Local completion (^N^P) The only match} | ]]) feed('<C-y>') screen:expect([[ foo | foo^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 {3:-- INSERT --} | ]]) feed('<ESC>') eq('foo', eval('getline(2)')) feed('o<C-r>=TestComplete()<CR>') screen:expect([[ - foo | - foo | + foo |*2 ^ | {2:foo }{0: }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 {3:-- INSERT --} | ]]) feed('<C-y><ESC>') @@ -232,21 +198,14 @@ describe('completion', function() foo | ^ | {1:foo }{0: }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 {3:-- Keyword Local completion (^N^P) }{5:Back at original} | ]]) feed('b') screen:expect([[ foo | b^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 {3:-- Keyword Local completion (^N^P) }{5:Back at original} | ]]) feed('ar<ESC>') @@ -257,9 +216,7 @@ describe('completion', function() bar | ^ | {1:foo }{0: }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 {3:-- INSERT --} | ]]) feed('bar<ESC>') @@ -272,21 +229,14 @@ describe('completion', function() foo | ^ | {1:foo }{0: }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 {3:-- Keyword Local completion (^N^P) }{5:Back at original} | ]]) feed('<ESC>') screen:expect([[ foo | ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 | ]]) eq('', eval('getline(2)')) @@ -296,9 +246,7 @@ describe('completion', function() | ^ | {1:foo }{0: }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 {3:-- INSERT --} | ]]) feed('<ESC>') @@ -306,10 +254,7 @@ describe('completion', function() foo | | ^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 | ]]) eq('', eval('getline(3)')) @@ -438,33 +383,20 @@ describe('completion', function() screen:expect([[ ug^ | {1:August }{0: }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 {3:-- User defined completion (^U^N^P) }{5:Back at original} | ]]) feed('<Down>') screen:expect([[ ug^ | {2:August }{0: }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 {3:-- User defined completion (^U^N^P) The only match} | ]]) feed('<C-y>') screen:expect([[ August^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*6 {3:-- INSERT --} | ]]) expect('August') @@ -476,10 +408,7 @@ describe('completion', function() | Ja^ | {1:January }{0: }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 {3:-- User defined completion (^U^N^P) }{5:Back at original} | ]]) feed('<BS>') @@ -489,8 +418,7 @@ describe('completion', function() {1:January }{0: }| {1:June }{0: }| {1:July }{0: }| - {0:~ }| - {0:~ }| + {0:~ }|*2 {3:-- User defined completion (^U^N^P) }{5:Back at original} | ]]) feed('<C-n>') @@ -500,8 +428,7 @@ describe('completion', function() {2:January }{0: }| {1:June }{0: }| {1:July }{0: }| - {0:~ }| - {0:~ }| + {0:~ }|*2 {3:-- User defined completion (^U^N^P) }{4:match 1 of 3} | ]]) feed('<C-n>') @@ -511,19 +438,14 @@ describe('completion', function() {1:January }{0: }| {2:June }{0: }| {1:July }{0: }| - {0:~ }| - {0:~ }| + {0:~ }|*2 {3:-- User defined completion (^U^N^P) }{4:match 2 of 3} | ]]) feed('<Esc>') screen:expect([[ | Jun^e | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 | ]]) feed('.') @@ -531,10 +453,7 @@ describe('completion', function() | June | Jun^e | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 | ]]) expect([[ @@ -705,12 +624,7 @@ describe('completion', function() feed('<cr>') screen:expect([[ 96^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*6 {3:-- INSERT --} | ]]) end) @@ -748,10 +662,7 @@ describe('completion', function() inc uninc indent unindent | ind^ | {2:indent }{0: }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 {3:-- Keyword Local completion (^N^P) }{4:match 1 of 2} | ]]) @@ -760,11 +671,7 @@ describe('completion', function() screen:expect([[ inc uninc indent unindent | indent^ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 {3:-- INSERT --} | ]]) -- Indents when completion is exited using ESC. @@ -773,10 +680,7 @@ describe('completion', function() inc uninc indent unindent | indent | in^d | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*4 | ]]) -- Works for unindenting too. @@ -789,8 +693,7 @@ describe('completion', function() ind | unind^ | {0:~ }{2: unindent }{0: }| - {0:~ }| - {0:~ }| + {0:~ }|*2 {3:-- Keyword Local completion (^N^P) }{4:match 1 of 2} | ]]) -- Works when going back and forth. @@ -801,8 +704,7 @@ describe('completion', function() ind | uninc^ | {0:~ }{2: uninc }{0: }| - {0:~ }| - {0:~ }| + {0:~ }|*2 {3:-- Keyword Local completion (^N^P) }{4:match 1 of 2} | ]]) feed("<BS>d") @@ -812,8 +714,7 @@ describe('completion', function() ind | unind^ | {0:~ }{2: unindent }{0: }| - {0:~ }| - {0:~ }| + {0:~ }|*2 {3:-- Keyword Local completion (^N^P) }{4:match 1 of 2} | ]]) feed("<C-N><C-N><C-Y><Esc>") @@ -822,9 +723,7 @@ describe('completion', function() indent | ind | uninden^t | - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 | ]]) end) @@ -835,22 +734,14 @@ describe('completion', function() screen:expect([[ ^foo | bar | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 | ]]) feed('A<C-x><C-l>') screen:expect([[ foo^ | bar | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 {3:-- Whole line completion (^L^N^P) }{7:Pattern not found} | ]]) eq(-1, eval('foldclosed(1)')) @@ -865,9 +756,7 @@ describe('completion', function() fooegg^ | {1:foobar }{0: }| {2:fooegg }{0: }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 {3:-- Keyword completion (^N^P) }{4:match 1 of 2} | ]]) @@ -878,9 +767,7 @@ describe('completion', function() fooegg^ | {1:foobar }{0: }| {2:fooegg }{0: }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 {3:-- Keyword completion (^N^P) }{4:match 1 of 2} | ]], unchanged=true} @@ -891,9 +778,7 @@ describe('completion', function() foobar^ | {2:foobar }{0: }| {1:fooegg }{0: }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 {3:-- Keyword completion (^N^P) }{4:match 2 of 2} | ]]) end) @@ -904,12 +789,7 @@ describe('completion', function() feed(':lua CURRENT_TESTING_<TAB>') screen:expect{grid=[[ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*6 :lua CURRENT_TESTING_VAR^ | ]]} end) @@ -920,11 +800,7 @@ describe('completion', function() feed(':lua CURRENT_TESTING_<TAB>') screen:expect{ grid = [[ | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 {10:CURRENT_TESTING_BAR}{9: CURRENT_TESTING_FOO }| :lua CURRENT_TESTING_BAR^ | ]], unchanged = true } @@ -958,9 +834,7 @@ describe('completion', function() | {8:[No Name] }| {0::}foo faa fee f^ | - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 {9:[Command Line] }| {3:-- INSERT --} | ]] ) @@ -980,9 +854,7 @@ describe('completion', function() | {8:[No Name] }| {0::}foo faa fee foo | - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 {9:[Command Line] }| :foo faa fee foo^ | ]]) @@ -1015,11 +887,7 @@ describe('completion', function() screen:expect([[ ^ | {1:1 3 2 }{0: }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 {3:-- INSERT --} | ]]) end) @@ -1062,9 +930,7 @@ describe('completion', function() bar | foobar | f^ | - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 {3:-- Keyword completion (^N^P) }{5:Back at original} | ]], popupmenu = { anchor = { 1, 3, 0 }, @@ -1081,9 +947,7 @@ describe('completion', function() bar | foobar | foob^ | - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 {3:-- Keyword completion (^N^P) }{5:Back at original} | ]], popupmenu = { anchor = { 1, 3, 0 }, @@ -1175,12 +1039,7 @@ describe('completion', function() {2:hello }{0: }| {1:hullo }{0: }| {1:heeee }{0: }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*6 {3:-- }{4:match 1 of 3} | ]]) command([[call timer_start(100, { -> execute('stopinsert') })]]) @@ -1191,15 +1050,7 @@ describe('completion', function() hullo | heee^e | hello | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*9 | ]]) end) @@ -1239,9 +1090,7 @@ describe('completion', function() {1:bar }{0: }| {1:foa }{0: }| {1:.hidden }{0: }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*3 {3:-- }{4:match 1 of 4} | ]]} feed('<Esc>ccf<C-n>') @@ -1249,11 +1098,7 @@ describe('completion', function() foo^ | {2:foo }{0: }| {1:foa }{0: }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| + {0:~ }|*5 {3:-- }{4:match 1 of 2} | ]]} end) |