diff options
author | ZyX <kp-pav@yandex.ru> | 2017-07-02 19:21:21 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-07-02 19:21:21 +0300 |
commit | 4b8bdd953e2b7928af80e8b97118d52f99f0d95a (patch) | |
tree | 1f4668d9df020d4741204c2263550ac9e5e1e518 /test/functional/api/keymap_spec.lua | |
parent | 936c070059f8c60085fa83fa7ea2ee4797d69f7b (diff) | |
download | rneovim-4b8bdd953e2b7928af80e8b97118d52f99f0d95a.tar.gz rneovim-4b8bdd953e2b7928af80e8b97118d52f99f0d95a.tar.bz2 rneovim-4b8bdd953e2b7928af80e8b97118d52f99f0d95a.zip |
functests: Remove local_copy function
Diffstat (limited to 'test/functional/api/keymap_spec.lua')
-rw-r--r-- | test/functional/api/keymap_spec.lua | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/test/functional/api/keymap_spec.lua b/test/functional/api/keymap_spec.lua index 833e0d2f3c..7d6445f49c 100644 --- a/test/functional/api/keymap_spec.lua +++ b/test/functional/api/keymap_spec.lua @@ -1,5 +1,6 @@ - local helpers = require('test.functional.helpers')(after_each) +local global_helpers = require('test.helpers') + local clear = helpers.clear local command = helpers.command local curbufmeths = helpers.curbufmeths @@ -8,13 +9,7 @@ local funcs = helpers.funcs local meths = helpers.meths local source = helpers.source -local function local_copy(t) - local copy = {} - for k,v in pairs(t) do - copy[k] = v - end - return copy -end +local shallowcopy = global_helpers.shallowcopy describe('get_keymap', function() before_each(clear) @@ -50,7 +45,7 @@ describe('get_keymap', function() -- Add another mapping command('nnoremap foo_longer bar_longer') - local foolong_bar_map_table = local_copy(foo_bar_map_table) + local foolong_bar_map_table = shallowcopy(foo_bar_map_table) foolong_bar_map_table['lhs'] = 'foo_longer' foolong_bar_map_table['rhs'] = 'bar_longer' @@ -72,7 +67,7 @@ describe('get_keymap', function() command('inoremap foo bar') -- The table will be the same except for the mode - local insert_table = local_copy(foo_bar_map_table) + local insert_table = shallowcopy(foo_bar_map_table) insert_table['mode'] = 'i' eq({insert_table}, meths.get_keymap('i')) @@ -81,11 +76,11 @@ describe('get_keymap', function() it('considers scope', function() -- change the map slightly command('nnoremap foo_longer bar_longer') - local foolong_bar_map_table = local_copy(foo_bar_map_table) + local foolong_bar_map_table = shallowcopy(foo_bar_map_table) foolong_bar_map_table['lhs'] = 'foo_longer' foolong_bar_map_table['rhs'] = 'bar_longer' - local buffer_table = local_copy(foo_bar_map_table) + local buffer_table = shallowcopy(foo_bar_map_table) buffer_table['buffer'] = 1 command('nnoremap <buffer> foo bar') @@ -98,7 +93,7 @@ describe('get_keymap', function() it('considers scope for overlapping maps', function() command('nnoremap foo bar') - local buffer_table = local_copy(foo_bar_map_table) + local buffer_table = shallowcopy(foo_bar_map_table) buffer_table['buffer'] = 1 command('nnoremap <buffer> foo bar') @@ -121,7 +116,7 @@ describe('get_keymap', function() command('nnoremap <buffer> foo bar') -- Final buffer will have buffer mappings - local buffer_table = local_copy(foo_bar_map_table) + local buffer_table = shallowcopy(foo_bar_map_table) buffer_table['buffer'] = final_buffer eq({buffer_table}, meths.buf_get_keymap(final_buffer, 'n')) eq({buffer_table}, meths.buf_get_keymap(0, 'n')) |