From a15ba262e4592cdfb270afad4471b023284cb215 Mon Sep 17 00:00:00 2001 From: Lucas Hoffmann Date: Thu, 11 Jun 2015 01:01:22 +0200 Subject: tests: Migrate legacy test argument_0count. --- test/functional/legacy/argument_0count_spec.lua | 38 +++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 test/functional/legacy/argument_0count_spec.lua (limited to 'test') diff --git a/test/functional/legacy/argument_0count_spec.lua b/test/functional/legacy/argument_0count_spec.lua new file mode 100644 index 0000000000..d27809c8d8 --- /dev/null +++ b/test/functional/legacy/argument_0count_spec.lua @@ -0,0 +1,38 @@ +-- Tests for :0argadd and :0argedit + +local helpers = require('test.functional.helpers') +local source, clear, expect = helpers.source, helpers.clear, helpers.expect + +describe('argument_0count', function() + setup(clear) + + it('is working', function() + source([[ + let arglists = [] + arga a b c d + 2argu + 0arga added + call add(arglists, argv()) + 2argu + arga third + call add(arglists, argv()) + %argd + arga a b c d + 2argu + 0arge edited + call add(arglists, argv()) + 2argu + arga third + call add(arglists, argv()) + call append(0, map(copy(arglists), 'join(v:val, " ")')) + ]]) + + -- Assert buffer contents. + expect([=[ + added a b c d + added a third b c d + edited a b c d + edited a third b c d + ]=]) + end) +end) -- cgit From 88b76ec146613797dbf3e4df76f52cd94ae1480e Mon Sep 17 00:00:00 2001 From: Lucas Hoffmann Date: Thu, 11 Jun 2015 01:18:35 +0200 Subject: tests: Modernize migrated legacy test argument_0count. --- test/functional/legacy/argument_0count_spec.lua | 46 ++++++++++--------------- 1 file changed, 18 insertions(+), 28 deletions(-) (limited to 'test') diff --git a/test/functional/legacy/argument_0count_spec.lua b/test/functional/legacy/argument_0count_spec.lua index d27809c8d8..6e8b60547b 100644 --- a/test/functional/legacy/argument_0count_spec.lua +++ b/test/functional/legacy/argument_0count_spec.lua @@ -1,38 +1,28 @@ -- Tests for :0argadd and :0argedit local helpers = require('test.functional.helpers') -local source, clear, expect = helpers.source, helpers.clear, helpers.expect +local eq, eval, clear, execute = + helpers.eq, helpers.eval, helpers.clear, helpers.execute describe('argument_0count', function() setup(clear) it('is working', function() - source([[ - let arglists = [] - arga a b c d - 2argu - 0arga added - call add(arglists, argv()) - 2argu - arga third - call add(arglists, argv()) - %argd - arga a b c d - 2argu - 0arge edited - call add(arglists, argv()) - 2argu - arga third - call add(arglists, argv()) - call append(0, map(copy(arglists), 'join(v:val, " ")')) - ]]) - - -- Assert buffer contents. - expect([=[ - added a b c d - added a third b c d - edited a b c d - edited a third b c d - ]=]) + execute('arga a b c d') + eq({'a', 'b', 'c', 'd'}, eval('argv()')) + execute('2argu') + execute('0arga added') + eq({'added', 'a', 'b', 'c', 'd'}, eval('argv()')) + execute('2argu') + execute('arga third') + eq({'added', 'a', 'third', 'b', 'c', 'd'}, eval('argv()')) + execute('%argd') + execute('arga a b c d') + execute('2argu') + execute('0arge edited') + eq({'edited', 'a', 'b', 'c', 'd'}, eval('argv()')) + execute('2argu') + execute('arga third') + eq({'edited', 'a', 'third', 'b', 'c', 'd'}, eval('argv()')) end) end) -- cgit