From f4d5d5250a105b5593e3119f4ee37ea20272a34b Mon Sep 17 00:00:00 2001 From: ZyX Date: Sat, 1 Apr 2017 23:57:34 +0300 Subject: eval: Refactor get_user_input to support dictionary --- test/functional/eval/input_spec.lua | 310 ++++++++++++++++++++++++++++++++++-- 1 file changed, 299 insertions(+), 11 deletions(-) (limited to 'test/functional') diff --git a/test/functional/eval/input_spec.lua b/test/functional/eval/input_spec.lua index 393fc10175..d655d9eb4a 100644 --- a/test/functional/eval/input_spec.lua +++ b/test/functional/eval/input_spec.lua @@ -1,9 +1,14 @@ local helpers = require('test.functional.helpers')(after_each) local Screen = require('test.functional.ui.screen') +local eq = helpers.eq +local wait = helpers.wait local feed = helpers.feed +local meths = helpers.meths local clear = helpers.clear +local source = helpers.source local command = helpers.command +local exc_exec = helpers.exc_exec local screen @@ -11,28 +16,311 @@ before_each(function() clear() screen = Screen.new(25, 5) screen:attach() + source([[ + hi Test ctermfg=Red guifg=Red term=bold + function CustomCompl(...) + return 'TEST' + endfunction + function CustomListCompl(...) + return ['FOO'] + endfunction + ]]) + screen:set_default_attr_ids({ + EOB={bold = true, foreground = Screen.colors.Blue1}, + T={foreground=Screen.colors.Red}, + }) end) describe('input()', function() it('works correctly with multiline prompts', function() feed([[:call input("Test\nFoo")]]) screen:expect([[ - {1:~ }| - {1:~ }| - {1:~ }| + {EOB:~ }| + {EOB:~ }| + {EOB:~ }| Test | Foo^ | - ]], {{bold=true, foreground=Screen.colors.Blue}}) + ]]) end) it('works correctly with multiline prompts and :echohl', function() - command('hi Test ctermfg=Red guifg=Red term=bold') feed([[:echohl Test | call input("Test\nFoo")]]) screen:expect([[ - {1:~ }| - {1:~ }| - {1:~ }| - {2:Test} | - {2:Foo}^ | - ]], {{bold=true, foreground=Screen.colors.Blue}, {foreground=Screen.colors.Red}}) + {EOB:~ }| + {EOB:~ }| + {EOB:~ }| + {T:Test} | + {T:Foo}^ | + ]]) + wait() + command('redraw!') + wait() + screen:expect([[ + | + {EOB:~ }| + {EOB:~ }| + {EOB:~ }| + {T:Foo}^ | + ]]) + end) + it('works correctly with multiple numeric arguments (many args)', function() + command('hi Test ctermfg=Red guifg=Red term=bold') + feed([[:echohl Test | call input(1, 2)]]) + wait() -- Without wait() it first shows `12` line and then empty line. + command('redraw!') -- Without this it shows two `12` lines. + wait() + -- None of the above problems happen when testing manually. + screen:expect([[ + | + {EOB:~ }| + {EOB:~ }| + {EOB:~ }| + {T:1}2^ | + ]]) + feed('') + wait() + screen:expect([[ + | + {EOB:~ }| + {EOB:~ }| + {EOB:~ }| + {T:1}^ | + ]]) + end) + it('works correctly with multiple numeric arguments (dict arg)', function() + feed([[:echohl Test | echo input({"prompt": 1, "default": 2, "cancelreturn": 3})]]) + wait() -- Without wait() it first shows `12` line and then empty line. + command('redraw!') -- Without this it shows two `12` lines. + -- None of the above problems happen when testing manually. + screen:expect([[ + | + {EOB:~ }| + {EOB:~ }| + {EOB:~ }| + {T:1}2^ | + ]]) + feed('') + wait() + screen:expect([[ + | + {EOB:~ }| + {EOB:~ }| + {EOB:~ }| + {T:1}^ | + ]]) + feed('') + wait() + screen:expect([[ + ^ | + {EOB:~ }| + {EOB:~ }| + {EOB:~ }| + {T:3} | + ]]) + end) + it('allows omitting everything with dictionary argument', function() + feed(':echohl Test | echo input({})') + wait() + command('redraw!') + screen:expect([[ + | + {EOB:~ }| + {EOB:~ }| + {EOB:~ }| + ^ | + ]]) + end) + it('supports completion', function() + feed(':let var = input("", "", "custom,CustomCompl")') + wait() + feed('') + eq('TEST', meths.get_var('var')) + + feed(':let var = input({"completion": "customlist,CustomListCompl"})') + wait() + feed('') + wait() + eq('FOO', meths.get_var('var')) + end) + it('supports cancelreturn', function() + feed(':let var = input({"cancelreturn": "BAR"})') + wait() + feed('') + wait() + eq('BAR', meths.get_var('var')) + end) + it('supports default string', function() + feed(':let var = input("", "DEF1")') + wait() + feed('') + eq('DEF1', meths.get_var('var')) + + feed(':let var = input({"default": "DEF2"})') + wait() + feed('') + wait() + eq('DEF2', meths.get_var('var')) + end) + it('errors out on invalid inputs', function() + eq('Vim(call):E730: using List as a String', + exc_exec('call input([])')) + eq('Vim(call):E730: using List as a String', + exc_exec('call input("", [])')) + eq('Vim(call):E730: using List as a String', + exc_exec('call input("", "", [])')) + eq('Vim(call):E730: using List as a String', + exc_exec('call input({"prompt": []})')) + eq('Vim(call):E730: using List as a String', + exc_exec('call input({"cancelreturn": []})')) + eq('Vim(call):E730: using List as a String', + exc_exec('call input({"default": []})')) + eq('Vim(call):E730: using List as a String', + exc_exec('call input({"completion": []})')) + end) +end) +describe('inputdialog()', function() + it('works correctly with multiline prompts', function() + feed([[:call inputdialog("Test\nFoo")]]) + screen:expect([[ + {EOB:~ }| + {EOB:~ }| + {EOB:~ }| + Test | + Foo^ | + ]]) + end) + it('works correctly with multiline prompts and :echohl', function() + feed([[:echohl Test | call inputdialog("Test\nFoo")]]) + screen:expect([[ + {EOB:~ }| + {EOB:~ }| + {EOB:~ }| + {T:Test} | + {T:Foo}^ | + ]]) + wait() + command('redraw!') + wait() + screen:expect([[ + | + {EOB:~ }| + {EOB:~ }| + {EOB:~ }| + {T:Foo}^ | + ]]) + end) + it('works correctly with multiple numeric arguments (many args)', function() + command('hi Test ctermfg=Red guifg=Red term=bold') + feed([[:echohl Test | call inputdialog(1, 2)]]) + wait() -- Without wait() it first shows `12` line and then empty line. + command('redraw!') -- Without this it shows two `12` lines. + wait() + -- None of the above problems happen when testing manually. + screen:expect([[ + | + {EOB:~ }| + {EOB:~ }| + {EOB:~ }| + {T:1}2^ | + ]]) + feed('') + wait() + screen:expect([[ + | + {EOB:~ }| + {EOB:~ }| + {EOB:~ }| + {T:1}^ | + ]]) + end) + it('works correctly with multiple numeric arguments (dict arg)', function() + feed([[:echohl Test | echo inputdialog({"prompt": 1, "default": 2, "cancelreturn": 3})]]) + wait() -- Without wait() it first shows `12` line and then empty line. + command('redraw!') -- Without this it shows two `12` lines. + -- None of the above problems happen when testing manually. + screen:expect([[ + | + {EOB:~ }| + {EOB:~ }| + {EOB:~ }| + {T:1}2^ | + ]]) + feed('') + wait() + screen:expect([[ + | + {EOB:~ }| + {EOB:~ }| + {EOB:~ }| + {T:1}^ | + ]]) + feed('') + wait() + screen:expect([[ + ^ | + {EOB:~ }| + {EOB:~ }| + {EOB:~ }| + {T:3} | + ]]) + end) + it('allows omitting everything with dictionary argument', function() + feed(':echohl Test | echo inputdialog({})') + wait() + command('redraw!') + screen:expect([[ + | + {EOB:~ }| + {EOB:~ }| + {EOB:~ }| + ^ | + ]]) + end) + it('supports completion', function() + feed(':let var = inputdialog({"completion": "customlist,CustomListCompl"})') + wait() + feed('') + wait() + eq('FOO', meths.get_var('var')) + end) + it('supports cancelreturn', function() + feed(':let var = inputdialog("", "", "CR1")') + wait() + feed('') + wait() + eq('CR1', meths.get_var('var')) + + feed(':let var = inputdialog({"cancelreturn": "BAR"})') + wait() + feed('') + wait() + eq('BAR', meths.get_var('var')) + end) + it('supports default string', function() + feed(':let var = inputdialog("", "DEF1")') + wait() + feed('') + eq('DEF1', meths.get_var('var')) + + feed(':let var = inputdialog({"default": "DEF2"})') + wait() + feed('') + wait() + eq('DEF2', meths.get_var('var')) + end) + it('errors out on invalid inputs', function() + eq('Vim(call):E730: using List as a String', + exc_exec('call inputdialog([])')) + eq('Vim(call):E730: using List as a String', + exc_exec('call inputdialog("", [])')) + eq('Vim(call):E730: using List as a String', + exc_exec('call inputdialog("", "", [])')) + eq('Vim(call):E730: using List as a String', + exc_exec('call inputdialog({"prompt": []})')) + eq('Vim(call):E730: using List as a String', + exc_exec('call inputdialog({"cancelreturn": []})')) + eq('Vim(call):E730: using List as a String', + exc_exec('call inputdialog({"default": []})')) + eq('Vim(call):E730: using List as a String', + exc_exec('call inputdialog({"completion": []})')) end) end) -- cgit From 5e6f7e1d558fed8ef7b368a62b68d59af6766143 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sat, 8 Apr 2017 21:30:47 +0300 Subject: eval: Alter E5050 error message, test that --- test/functional/eval/input_spec.lua | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test/functional') diff --git a/test/functional/eval/input_spec.lua b/test/functional/eval/input_spec.lua index d655d9eb4a..51fd06dd90 100644 --- a/test/functional/eval/input_spec.lua +++ b/test/functional/eval/input_spec.lua @@ -175,6 +175,10 @@ describe('input()', function() exc_exec('call input({"default": []})')) eq('Vim(call):E730: using List as a String', exc_exec('call input({"completion": []})')) + eq('Vim(call):E5050: {opts} must be the only argument', + exc_exec('call input({}, "default")')) + eq('Vim(call):E118: Too many arguments for function: input', + exc_exec('call input("prompt> ", "default", "file", "extra")')) end) end) describe('inputdialog()', function() @@ -322,5 +326,9 @@ describe('inputdialog()', function() exc_exec('call inputdialog({"default": []})')) eq('Vim(call):E730: using List as a String', exc_exec('call inputdialog({"completion": []})')) + eq('Vim(call):E5050: {opts} must be the only argument', + exc_exec('call inputdialog({}, "default")')) + eq('Vim(call):E118: Too many arguments for function: inputdialog', + exc_exec('call inputdialog("prompt> ", "default", "file", "extra")')) end) end) -- cgit From 4c4f741aec1c6faf4f5a06c7c21747e360a465ac Mon Sep 17 00:00:00 2001 From: ZyX Date: Wed, 10 May 2017 23:05:58 +0300 Subject: functests: Remove all wait()s --- test/functional/eval/input_spec.lua | 36 ------------------------------------ 1 file changed, 36 deletions(-) (limited to 'test/functional') diff --git a/test/functional/eval/input_spec.lua b/test/functional/eval/input_spec.lua index 51fd06dd90..8f790320cf 100644 --- a/test/functional/eval/input_spec.lua +++ b/test/functional/eval/input_spec.lua @@ -2,7 +2,6 @@ local helpers = require('test.functional.helpers')(after_each) local Screen = require('test.functional.ui.screen') local eq = helpers.eq -local wait = helpers.wait local feed = helpers.feed local meths = helpers.meths local clear = helpers.clear @@ -51,9 +50,7 @@ describe('input()', function() {T:Test} | {T:Foo}^ | ]]) - wait() command('redraw!') - wait() screen:expect([[ | {EOB:~ }| @@ -65,9 +62,7 @@ describe('input()', function() it('works correctly with multiple numeric arguments (many args)', function() command('hi Test ctermfg=Red guifg=Red term=bold') feed([[:echohl Test | call input(1, 2)]]) - wait() -- Without wait() it first shows `12` line and then empty line. command('redraw!') -- Without this it shows two `12` lines. - wait() -- None of the above problems happen when testing manually. screen:expect([[ | @@ -77,7 +72,6 @@ describe('input()', function() {T:1}2^ | ]]) feed('') - wait() screen:expect([[ | {EOB:~ }| @@ -88,7 +82,6 @@ describe('input()', function() end) it('works correctly with multiple numeric arguments (dict arg)', function() feed([[:echohl Test | echo input({"prompt": 1, "default": 2, "cancelreturn": 3})]]) - wait() -- Without wait() it first shows `12` line and then empty line. command('redraw!') -- Without this it shows two `12` lines. -- None of the above problems happen when testing manually. screen:expect([[ @@ -99,7 +92,6 @@ describe('input()', function() {T:1}2^ | ]]) feed('') - wait() screen:expect([[ | {EOB:~ }| @@ -108,7 +100,6 @@ describe('input()', function() {T:1}^ | ]]) feed('') - wait() screen:expect([[ ^ | {EOB:~ }| @@ -119,7 +110,6 @@ describe('input()', function() end) it('allows omitting everything with dictionary argument', function() feed(':echohl Test | echo input({})') - wait() command('redraw!') screen:expect([[ | @@ -131,33 +121,25 @@ describe('input()', function() end) it('supports completion', function() feed(':let var = input("", "", "custom,CustomCompl")') - wait() feed('') eq('TEST', meths.get_var('var')) feed(':let var = input({"completion": "customlist,CustomListCompl"})') - wait() feed('') - wait() eq('FOO', meths.get_var('var')) end) it('supports cancelreturn', function() feed(':let var = input({"cancelreturn": "BAR"})') - wait() feed('') - wait() eq('BAR', meths.get_var('var')) end) it('supports default string', function() feed(':let var = input("", "DEF1")') - wait() feed('') eq('DEF1', meths.get_var('var')) feed(':let var = input({"default": "DEF2"})') - wait() feed('') - wait() eq('DEF2', meths.get_var('var')) end) it('errors out on invalid inputs', function() @@ -201,9 +183,7 @@ describe('inputdialog()', function() {T:Test} | {T:Foo}^ | ]]) - wait() command('redraw!') - wait() screen:expect([[ | {EOB:~ }| @@ -215,9 +195,7 @@ describe('inputdialog()', function() it('works correctly with multiple numeric arguments (many args)', function() command('hi Test ctermfg=Red guifg=Red term=bold') feed([[:echohl Test | call inputdialog(1, 2)]]) - wait() -- Without wait() it first shows `12` line and then empty line. command('redraw!') -- Without this it shows two `12` lines. - wait() -- None of the above problems happen when testing manually. screen:expect([[ | @@ -227,7 +205,6 @@ describe('inputdialog()', function() {T:1}2^ | ]]) feed('') - wait() screen:expect([[ | {EOB:~ }| @@ -238,7 +215,6 @@ describe('inputdialog()', function() end) it('works correctly with multiple numeric arguments (dict arg)', function() feed([[:echohl Test | echo inputdialog({"prompt": 1, "default": 2, "cancelreturn": 3})]]) - wait() -- Without wait() it first shows `12` line and then empty line. command('redraw!') -- Without this it shows two `12` lines. -- None of the above problems happen when testing manually. screen:expect([[ @@ -249,7 +225,6 @@ describe('inputdialog()', function() {T:1}2^ | ]]) feed('') - wait() screen:expect([[ | {EOB:~ }| @@ -258,7 +233,6 @@ describe('inputdialog()', function() {T:1}^ | ]]) feed('') - wait() screen:expect([[ ^ | {EOB:~ }| @@ -269,7 +243,6 @@ describe('inputdialog()', function() end) it('allows omitting everything with dictionary argument', function() feed(':echohl Test | echo inputdialog({})') - wait() command('redraw!') screen:expect([[ | @@ -281,34 +254,25 @@ describe('inputdialog()', function() end) it('supports completion', function() feed(':let var = inputdialog({"completion": "customlist,CustomListCompl"})') - wait() feed('') - wait() eq('FOO', meths.get_var('var')) end) it('supports cancelreturn', function() feed(':let var = inputdialog("", "", "CR1")') - wait() feed('') - wait() eq('CR1', meths.get_var('var')) feed(':let var = inputdialog({"cancelreturn": "BAR"})') - wait() feed('') - wait() eq('BAR', meths.get_var('var')) end) it('supports default string', function() feed(':let var = inputdialog("", "DEF1")') - wait() feed('') eq('DEF1', meths.get_var('var')) feed(':let var = inputdialog({"default": "DEF2"})') - wait() feed('') - wait() eq('DEF2', meths.get_var('var')) end) it('errors out on invalid inputs', function() -- cgit From 88d4a260e1e798d1ebf2b9720c0f9ca631507b71 Mon Sep 17 00:00:00 2001 From: ZyX Date: Wed, 10 May 2017 23:14:23 +0300 Subject: functests: Remove some redraw calls --- test/functional/eval/input_spec.lua | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'test/functional') diff --git a/test/functional/eval/input_spec.lua b/test/functional/eval/input_spec.lua index 8f790320cf..857bde54d3 100644 --- a/test/functional/eval/input_spec.lua +++ b/test/functional/eval/input_spec.lua @@ -60,9 +60,8 @@ describe('input()', function() ]]) end) it('works correctly with multiple numeric arguments (many args)', function() - command('hi Test ctermfg=Red guifg=Red term=bold') - feed([[:echohl Test | call input(1, 2)]]) - command('redraw!') -- Without this it shows two `12` lines. + command('echohl Test') + feed([[:call input(1, 2)]]) -- None of the above problems happen when testing manually. screen:expect([[ | @@ -82,7 +81,7 @@ describe('input()', function() end) it('works correctly with multiple numeric arguments (dict arg)', function() feed([[:echohl Test | echo input({"prompt": 1, "default": 2, "cancelreturn": 3})]]) - command('redraw!') -- Without this it shows two `12` lines. + command('redraw!') -- Without this it shows `12` on the line above. -- None of the above problems happen when testing manually. screen:expect([[ | @@ -109,8 +108,8 @@ describe('input()', function() ]]) end) it('allows omitting everything with dictionary argument', function() - feed(':echohl Test | echo input({})') - command('redraw!') + command('echohl Test') + feed([[:call input({})]]) screen:expect([[ | {EOB:~ }| @@ -193,9 +192,8 @@ describe('inputdialog()', function() ]]) end) it('works correctly with multiple numeric arguments (many args)', function() - command('hi Test ctermfg=Red guifg=Red term=bold') - feed([[:echohl Test | call inputdialog(1, 2)]]) - command('redraw!') -- Without this it shows two `12` lines. + command('echohl Test') + feed([[:call inputdialog(1, 2)]]) -- None of the above problems happen when testing manually. screen:expect([[ | @@ -215,7 +213,7 @@ describe('inputdialog()', function() end) it('works correctly with multiple numeric arguments (dict arg)', function() feed([[:echohl Test | echo inputdialog({"prompt": 1, "default": 2, "cancelreturn": 3})]]) - command('redraw!') -- Without this it shows two `12` lines. + command('redraw!') -- Without this it shows `12` on the line above. -- None of the above problems happen when testing manually. screen:expect([[ | @@ -242,8 +240,8 @@ describe('inputdialog()', function() ]]) end) it('allows omitting everything with dictionary argument', function() - feed(':echohl Test | echo inputdialog({})') - command('redraw!') + command('echohl Test') + feed(':echo inputdialog({})') screen:expect([[ | {EOB:~ }| -- cgit From 33ca9f711e9a80df8edfc3e5c7519fb5fb7fff2b Mon Sep 17 00:00:00 2001 From: ZyX Date: Wed, 10 May 2017 23:19:49 +0300 Subject: functests: Remove outdated comments --- test/functional/eval/input_spec.lua | 4 ---- 1 file changed, 4 deletions(-) (limited to 'test/functional') diff --git a/test/functional/eval/input_spec.lua b/test/functional/eval/input_spec.lua index 857bde54d3..a703dbc166 100644 --- a/test/functional/eval/input_spec.lua +++ b/test/functional/eval/input_spec.lua @@ -62,7 +62,6 @@ describe('input()', function() it('works correctly with multiple numeric arguments (many args)', function() command('echohl Test') feed([[:call input(1, 2)]]) - -- None of the above problems happen when testing manually. screen:expect([[ | {EOB:~ }| @@ -82,7 +81,6 @@ describe('input()', function() it('works correctly with multiple numeric arguments (dict arg)', function() feed([[:echohl Test | echo input({"prompt": 1, "default": 2, "cancelreturn": 3})]]) command('redraw!') -- Without this it shows `12` on the line above. - -- None of the above problems happen when testing manually. screen:expect([[ | {EOB:~ }| @@ -194,7 +192,6 @@ describe('inputdialog()', function() it('works correctly with multiple numeric arguments (many args)', function() command('echohl Test') feed([[:call inputdialog(1, 2)]]) - -- None of the above problems happen when testing manually. screen:expect([[ | {EOB:~ }| @@ -214,7 +211,6 @@ describe('inputdialog()', function() it('works correctly with multiple numeric arguments (dict arg)', function() feed([[:echohl Test | echo inputdialog({"prompt": 1, "default": 2, "cancelreturn": 3})]]) command('redraw!') -- Without this it shows `12` on the line above. - -- None of the above problems happen when testing manually. screen:expect([[ | {EOB:~ }| -- cgit From b6d73fb7407f8d37bc6a700d09a5eed6c3129539 Mon Sep 17 00:00:00 2001 From: ZyX Date: Thu, 11 May 2017 12:15:41 +0300 Subject: functests: Get rid of last redraws due to the “line above” issue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/functional/eval/input_spec.lua | 82 +++++++++++++++++++++++++++++++++++-- 1 file changed, 78 insertions(+), 4 deletions(-) (limited to 'test/functional') diff --git a/test/functional/eval/input_spec.lua b/test/functional/eval/input_spec.lua index a703dbc166..13e93a4764 100644 --- a/test/functional/eval/input_spec.lua +++ b/test/functional/eval/input_spec.lua @@ -79,8 +79,9 @@ describe('input()', function() ]]) end) it('works correctly with multiple numeric arguments (dict arg)', function() - feed([[:echohl Test | echo input({"prompt": 1, "default": 2, "cancelreturn": 3})]]) - command('redraw!') -- Without this it shows `12` on the line above. + command('echohl Test') + meths.set_var('opts', {prompt=1, default=2, cancelreturn=3}) + feed([[:echo input(opts)]]) screen:expect([[ | {EOB:~ }| @@ -105,6 +106,42 @@ describe('input()', function() {T:3} | ]]) end) + it('works correctly with redraw', function() + command('echohl Test') + meths.set_var('opts', {prompt='Foo>', default='Bar'}) + feed([[:echo inputdialog(opts)]]) + screen:expect([[ + | + {EOB:~ }| + {EOB:~ }| + {EOB:~ }| + {T:Foo>}Bar^ | + ]]) + command('redraw!') + screen:expect([[ + | + {EOB:~ }| + {EOB:~ }| + {EOB:~ }| + {T:Foo>}Bar^ | + ]]) + feed('') + screen:expect([[ + | + {EOB:~ }| + {EOB:~ }| + {EOB:~ }| + {T:Foo>}Ba^ | + ]]) + command('redraw!') + screen:expect([[ + | + {EOB:~ }| + {EOB:~ }| + {EOB:~ }| + {T:Foo>}Ba^ | + ]]) + end) it('allows omitting everything with dictionary argument', function() command('echohl Test') feed([[:call input({})]]) @@ -209,8 +246,9 @@ describe('inputdialog()', function() ]]) end) it('works correctly with multiple numeric arguments (dict arg)', function() - feed([[:echohl Test | echo inputdialog({"prompt": 1, "default": 2, "cancelreturn": 3})]]) - command('redraw!') -- Without this it shows `12` on the line above. + command('echohl Test') + meths.set_var('opts', {prompt=1, default=2, cancelreturn=3}) + feed([[:echo input(opts)]]) screen:expect([[ | {EOB:~ }| @@ -235,6 +273,42 @@ describe('inputdialog()', function() {T:3} | ]]) end) + it('works correctly with redraw', function() + command('echohl Test') + meths.set_var('opts', {prompt='Foo>', default='Bar'}) + feed([[:echo input(opts)]]) + screen:expect([[ + | + {EOB:~ }| + {EOB:~ }| + {EOB:~ }| + {T:Foo>}Bar^ | + ]]) + command('redraw!') + screen:expect([[ + | + {EOB:~ }| + {EOB:~ }| + {EOB:~ }| + {T:Foo>}Bar^ | + ]]) + feed('') + screen:expect([[ + | + {EOB:~ }| + {EOB:~ }| + {EOB:~ }| + {T:Foo>}Ba^ | + ]]) + command('redraw!') + screen:expect([[ + | + {EOB:~ }| + {EOB:~ }| + {EOB:~ }| + {T:Foo>}Ba^ | + ]]) + end) it('allows omitting everything with dictionary argument', function() command('echohl Test') feed(':echo inputdialog({})') -- cgit From 9906db985d064e870b882f1e36f820dd7ce90215 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sat, 13 May 2017 17:04:54 +0300 Subject: functests: Remove “correctly” from non-regression tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/functional/eval/input_spec.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'test/functional') diff --git a/test/functional/eval/input_spec.lua b/test/functional/eval/input_spec.lua index 13e93a4764..2eaadad18f 100644 --- a/test/functional/eval/input_spec.lua +++ b/test/functional/eval/input_spec.lua @@ -31,7 +31,7 @@ before_each(function() end) describe('input()', function() - it('works correctly with multiline prompts', function() + it('works with multiline prompts', function() feed([[:call input("Test\nFoo")]]) screen:expect([[ {EOB:~ }| @@ -41,7 +41,7 @@ describe('input()', function() Foo^ | ]]) end) - it('works correctly with multiline prompts and :echohl', function() + it('works with multiline prompts and :echohl', function() feed([[:echohl Test | call input("Test\nFoo")]]) screen:expect([[ {EOB:~ }| @@ -106,7 +106,7 @@ describe('input()', function() {T:3} | ]]) end) - it('works correctly with redraw', function() + it('works with redraw', function() command('echohl Test') meths.set_var('opts', {prompt='Foo>', default='Bar'}) feed([[:echo inputdialog(opts)]]) @@ -198,7 +198,7 @@ describe('input()', function() end) end) describe('inputdialog()', function() - it('works correctly with multiline prompts', function() + it('works with multiline prompts', function() feed([[:call inputdialog("Test\nFoo")]]) screen:expect([[ {EOB:~ }| @@ -208,7 +208,7 @@ describe('inputdialog()', function() Foo^ | ]]) end) - it('works correctly with multiline prompts and :echohl', function() + it('works with multiline prompts and :echohl', function() feed([[:echohl Test | call inputdialog("Test\nFoo")]]) screen:expect([[ {EOB:~ }| @@ -273,7 +273,7 @@ describe('inputdialog()', function() {T:3} | ]]) end) - it('works correctly with redraw', function() + it('works with redraw', function() command('echohl Test') meths.set_var('opts', {prompt='Foo>', default='Bar'}) feed([[:echo input(opts)]]) -- cgit From a59ddde72145ef37a374ce680d7e785d63aecf52 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sat, 13 May 2017 17:07:31 +0300 Subject: functests: Reword regression test headers --- test/functional/eval/input_spec.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'test/functional') diff --git a/test/functional/eval/input_spec.lua b/test/functional/eval/input_spec.lua index 2eaadad18f..74ad32bc6c 100644 --- a/test/functional/eval/input_spec.lua +++ b/test/functional/eval/input_spec.lua @@ -59,7 +59,7 @@ describe('input()', function() {T:Foo}^ | ]]) end) - it('works correctly with multiple numeric arguments (many args)', function() + it('allows unequal numeric arguments when using multiple args', function() command('echohl Test') feed([[:call input(1, 2)]]) screen:expect([[ @@ -78,7 +78,7 @@ describe('input()', function() {T:1}^ | ]]) end) - it('works correctly with multiple numeric arguments (dict arg)', function() + it('allows unequal numeric values when using {opts} dictionary', function() command('echohl Test') meths.set_var('opts', {prompt=1, default=2, cancelreturn=3}) feed([[:echo input(opts)]]) @@ -226,7 +226,7 @@ describe('inputdialog()', function() {T:Foo}^ | ]]) end) - it('works correctly with multiple numeric arguments (many args)', function() + it('allows unequal numeric arguments when using multiple args', function() command('echohl Test') feed([[:call inputdialog(1, 2)]]) screen:expect([[ @@ -245,7 +245,7 @@ describe('inputdialog()', function() {T:1}^ | ]]) end) - it('works correctly with multiple numeric arguments (dict arg)', function() + it('allows unequal numeric values when using {opts} dictionary', function() command('echohl Test') meths.set_var('opts', {prompt=1, default=2, cancelreturn=3}) feed([[:echo input(opts)]]) -- cgit