aboutsummaryrefslogtreecommitdiff
path: root/test/functional/legacy/put_spec.lua
blob: 3ddf65490e195ce8a7b96ad1dd70425d18d95e34 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
local helpers = require('test.functional.helpers')(after_each)
local clear = helpers.clear
local exec_lua = helpers.exec_lua
local meths = helpers.meths
local source = helpers.source
local eq = helpers.eq

local function sizeoflong()
  if not exec_lua('return pcall(require, "ffi")') then
    pending('missing LuaJIT FFI')
  end
  return exec_lua('return require("ffi").sizeof(require("ffi").typeof("long"))')
end

describe('put', function()
  before_each(clear)
  after_each(function() eq({}, meths.get_vvar('errors')) end)

  it('very large count 64-bit', function()
    if sizeoflong() < 8 then
      pending('Skipped: only works with 64 bit long ints')
    end

    source [[
      new
      let @" = repeat('x', 100)
      call assert_fails('norm 999999999p', 'E1240:')
      bwipe!
    ]]
  end)

  it('very large count (visual block) 64-bit', function()
    if sizeoflong() < 8 then
      pending('Skipped: only works with 64 bit long ints')
    end

    source [[
      new
      call setline(1, repeat('x', 100))
      exe "norm \<C-V>$y"
      call assert_fails('norm 999999999p', 'E1240:')
      bwipe!
    ]]
  end)
end)