diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2016-11-15 03:21:50 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2016-11-15 05:01:25 +0100 |
commit | 35231312d785e4fd1f534e573a43f5a9a4a0fe8f (patch) | |
tree | cd65baed8711f3ccdfa79064920c8772861b6715 /test/functional/ui/inccommand_spec.lua | |
parent | 3f7a2d785dcc8c3dad341669c83f29779987d9a4 (diff) | |
download | rneovim-35231312d785e4fd1f534e573a43f5a9a4a0fe8f.tar.gz rneovim-35231312d785e4fd1f534e573a43f5a9a4a0fe8f.tar.bz2 rneovim-35231312d785e4fd1f534e573a43f5a9a4a0fe8f.zip |
'inccommand': Add tests.
Diffstat (limited to 'test/functional/ui/inccommand_spec.lua')
-rw-r--r-- | test/functional/ui/inccommand_spec.lua | 119 |
1 files changed, 119 insertions, 0 deletions
diff --git a/test/functional/ui/inccommand_spec.lua b/test/functional/ui/inccommand_spec.lua index 811fee3a82..2899925ed8 100644 --- a/test/functional/ui/inccommand_spec.lua +++ b/test/functional/ui/inccommand_spec.lua @@ -761,6 +761,7 @@ describe(":substitute, inccommand=split", function() it('does not show split window for :s/', function() feed("2gg") feed(":s/tw") + wait() screen:expect([[ Inc substitution on | two lines | @@ -935,6 +936,89 @@ describe(":substitute, inccommand=split", function() ]]) end) + it("deactivates if 'redrawtime' is exceeded #5602", function() + -- Assert that 'inccommand' is ENABLED initially. + eq("split", eval("&inccommand")) + -- Set 'redrawtime' to minimal value, to ensure timeout is triggered. + execute("set redrawtime=1 nowrap") + -- Load a big file. + execute("silent edit! test/functional/fixtures/bigfile.txt") + -- Start :substitute with a slow pattern. + feed([[:%s/B.*N/x]]) + wait() + + -- Assert that 'inccommand' is DISABLED in cmdline mode. + eq("", eval("&inccommand")) + -- Assert that preview cleared (or never manifested). + screen:expect([[ + 0000;<control>;Cc;0;BN;;;;;N;N| + 0001;<control>;Cc;0;BN;;;;;N;S| + 0002;<control>;Cc;0;BN;;;;;N;S| + 0003;<control>;Cc;0;BN;;;;;N;E| + 0004;<control>;Cc;0;BN;;;;;N;E| + 0005;<control>;Cc;0;BN;;;;;N;E| + 0006;<control>;Cc;0;BN;;;;;N;A| + 0007;<control>;Cc;0;BN;;;;;N;B| + 0008;<control>;Cc;0;BN;;;;;N;B| + 0009;<control>;Cc;0;S;;;;;N;CH| + 000A;<control>;Cc;0;B;;;;;N;LI| + 000B;<control>;Cc;0;S;;;;;N;LI| + 000C;<control>;Cc;0;WS;;;;;N;F| + 000D;<control>;Cc;0;B;;;;;N;CA| + :%s/B.*N/x^ | + ]]) + + -- Assert that 'inccommand' is again ENABLED after leaving cmdline mode. + feed([[<C-\><C-N>]]) + eq("split", eval("&inccommand")) + end) + + it("clears preview if non-previewable command is edited #5585", function() + -- Put a non-previewable command in history. + execute("echo 'foo'") + -- Start an incomplete :substitute command. + feed(":1,2s/t/X") + + screen:expect([[ + Inc subsXitution on | + Xwo lines | + Inc substitution on | + two lines | + | + {11:[No Name] [+] }| + |1| Inc subs{12:X}itution on | + |2| {12:X}wo lines | + | + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {10:[Preview] }| + :1,2s/t/X^ | + ]]) + + -- Select the previous command. + feed("<C-P>") + -- Assert that preview was cleared. + screen:expect([[ + Inc substitution on | + two lines | + Inc substitution on | + two lines | + | + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + :echo 'foo'^ | + ]]) + end) + end) describe("inccommand=nosplit", function() @@ -1046,6 +1130,41 @@ describe("inccommand=nosplit", function() ]]) end) + it("clears preview if non-previewable command is edited", function() + -- Put a non-previewable command in history. + execute("echo 'foo'") + -- Start an incomplete :substitute command. + feed(":1,2s/t/X") + + screen:expect([[ + Inc subsXitution on | + Xwo lines | + Inc substitution on | + two lines | + | + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + :1,2s/t/X^ | + ]]) + + -- Select the previous command. + feed("<C-P>") + -- Assert that preview was cleared. + screen:expect([[ + Inc substitution on | + two lines | + Inc substitution on | + two lines | + | + {15:~ }| + {15:~ }| + {15:~ }| + {15:~ }| + :echo 'foo'^ | + ]]) + end) end) describe(":substitute, 'inccommand' with a failing expression", function() |