diff options
author | ZyX <kp-pav@yandex.ru> | 2015-09-22 15:03:27 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2015-10-08 22:01:10 +0300 |
commit | 0966e92cf441bbae1d50c68f56809fbb08fab7b6 (patch) | |
tree | 3abaeeef01d2c04c9f73942b5260aea7bf7adc70 /test/functional/shada/shada_spec.lua | |
parent | 7085ea07d8e5f976260476f2e84c38b3a3bf0407 (diff) | |
download | rneovim-0966e92cf441bbae1d50c68f56809fbb08fab7b6.tar.gz rneovim-0966e92cf441bbae1d50c68f56809fbb08fab7b6.tar.bz2 rneovim-0966e92cf441bbae1d50c68f56809fbb08fab7b6.zip |
shada: When using shada-r normalize option path
Diffstat (limited to 'test/functional/shada/shada_spec.lua')
-rw-r--r-- | test/functional/shada/shada_spec.lua | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/test/functional/shada/shada_spec.lua b/test/functional/shada/shada_spec.lua index ed022ea65c..dfd5c436e4 100644 --- a/test/functional/shada/shada_spec.lua +++ b/test/functional/shada/shada_spec.lua @@ -7,6 +7,7 @@ local write_file, spawn, set_session, nvim_prog, exc_exec = helpers.write_file, helpers.spawn, helpers.set_session, helpers.nvim_prog, helpers.exc_exec local lfs = require('lfs') +local paths = require('test.config.paths') local msgpack = require('MessagePack') @@ -146,4 +147,42 @@ describe('ShaDa support code', function() session:exit(0) os.remove('NONE') end) + + it('correctly uses shada-r option', function() + nvim('set_var', '__home', paths.test_source_path) + nvim_command('let $HOME = __home') + nvim_command('unlet __home') + nvim_command('edit ~/README.md') + nvim_command('normal! GmAggmaAabc') + nvim_command('undo') + nvim_command('set shada+=%') + nvim_command('wshada! ' .. shada_fname) + local marklike = {[7]=true, [8]=true, [10]=true, [11]=true} + local readme_fname = paths.test_source_path .. '/README.md' + local find_readme = function() + local found = {} + for _, v in ipairs(read_shada_file(shada_fname)) do + if marklike[v.type] and v.value.f == readme_fname then + found[v.type] = (found[v.type] or 0) + 1 + elseif v.type == 9 then + for _, b in ipairs(v.value) do + if b.f == readme_fname then + found[v.type] = (found[v.type] or 0) + 1 + end + end + end + end + return found + end + eq({[7]=1, [8]=2, [9]=1, [10]=4, [11]=1}, find_readme()) + nvim_command('set shada+=r~') + nvim_command('wshada! ' .. shada_fname) + eq({}, find_readme()) + nvim_command('set shada-=r~') + nvim_command('wshada! ' .. shada_fname) + eq({[7]=1, [8]=2, [9]=1, [10]=4, [11]=1}, find_readme()) + nvim_command('set shada+=r' .. paths.test_source_path) + nvim_command('wshada! ' .. shada_fname) + eq({}, find_readme()) + end) end) |