diff options
author | ZyX <kp-pav@yandex.ru> | 2016-09-24 00:51:34 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-03-29 10:08:06 +0300 |
commit | 7ceebacb3fad49ba8321397cf839948caa55b3f5 (patch) | |
tree | 4c7179f83001d9c7f0b25045e6779bc8df26b81e /test/functional/eval/container_functions_spec.lua | |
parent | 56e4c2f67e54b88f637d30e565313bc6b2c22f29 (diff) | |
download | rneovim-7ceebacb3fad49ba8321397cf839948caa55b3f5.tar.gz rneovim-7ceebacb3fad49ba8321397cf839948caa55b3f5.tar.bz2 rneovim-7ceebacb3fad49ba8321397cf839948caa55b3f5.zip |
eval/typval,tests: Fix extending list with itself, add tests
Adds unit test for tv_list_extend and regression test for extend() VimL
function.
Diffstat (limited to 'test/functional/eval/container_functions_spec.lua')
-rw-r--r-- | test/functional/eval/container_functions_spec.lua | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/functional/eval/container_functions_spec.lua b/test/functional/eval/container_functions_spec.lua new file mode 100644 index 0000000000..04a3248c49 --- /dev/null +++ b/test/functional/eval/container_functions_spec.lua @@ -0,0 +1,24 @@ +local helpers = require('test.functional.helpers')(after_each) + +local eq = helpers.eq +local eval = helpers.eval +local meths = helpers.meths +local clear = helpers.clear + +before_each(clear) + +describe('extend()', function() + it('suceeds to extend list with itself', function() + meths.set_var('l', {1, {}}) + eq({1, {}, 1, {}}, eval('extend(l, l)')) + eq({1, {}, 1, {}}, meths.get_var('l')) + + meths.set_var('l', {1, {}}) + eq({1, {}, 1, {}}, eval('extend(l, l, 0)')) + eq({1, {}, 1, {}}, meths.get_var('l')) + + meths.set_var('l', {1, {}}) + eq({1, 1, {}, {}}, eval('extend(l, l, 1)')) + eq({1, 1, {}, {}}, meths.get_var('l')) + end) +end) |