~ubuntu-branches/debian/sid/neovim/sid

« back to all changes in this revision

Viewing changes to test/functional/shada/errors_spec.lua

  • Committer: Package Import Robot
  • Author(s): James McCoy
  • Date: 2016-02-20 22:41:32 UTC
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: package-import@ubuntu.com-20160220224132-e24n8lh3yo5ylt23
Tags: upstream-0.1.2
ImportĀ upstreamĀ versionĀ 0.1.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
-- ShaDa errors handling support
2
2
local helpers = require('test.functional.helpers')
3
 
local nvim_command, eq, exc_exec = helpers.command, helpers.eq, helpers.exc_exec
 
3
local nvim_command, eq, exc_exec, redir_exec =
 
4
  helpers.command, helpers.eq, helpers.exc_exec, helpers.redir_exec
4
5
 
5
6
local shada_helpers = require('test.functional.shada.helpers')
6
7
local reset, clear, get_shada_rw =
492
493
    eq('Vim(wshada):E576: Error while reading ShaDa file: last entry specified that it occupies 47 bytes, but file ended earlier', exc_exec('wshada ' .. shada_fname))
493
494
    eq(0, exc_exec('wshada! ' .. shada_fname))
494
495
  end)
 
496
 
 
497
  it('errors when a funcref is stored in a variable', function()
 
498
    nvim_command('let F = function("tr")')
 
499
    nvim_command('set shada+=!')
 
500
    eq('\nE951: Error while dumping variable g:F, itself: attempt to dump function reference'
 
501
       .. '\nE574: Failed to write variable F',
 
502
       redir_exec('wshada'))
 
503
  end)
 
504
 
 
505
  it('errors when a self-referencing list is stored in a variable', function()
 
506
    nvim_command('let L = []')
 
507
    nvim_command('call add(L, L)')
 
508
    nvim_command('set shada+=!')
 
509
    eq('\nE952: Unable to dump variable g:L: container references itself in index 0'
 
510
       .. '\nE574: Failed to write variable L',
 
511
       redir_exec('wshada'))
 
512
  end)
495
513
end)