mirror of
https://github.com/neovim/neovim.git
synced 2025-12-15 19:05:40 +00:00
test: support upvalues in exec_lua
This commit is contained in:
committed by
Lewis Russell
parent
a19e89022d
commit
e5c174421d
@@ -15,27 +15,27 @@ describe('ffi.cdef', function()
|
||||
|
||||
eq(
|
||||
12,
|
||||
exec_lua [=[
|
||||
local ffi = require('ffi')
|
||||
exec_lua(function()
|
||||
local ffi = require('ffi')
|
||||
|
||||
ffi.cdef [[
|
||||
ffi.cdef [[
|
||||
typedef struct window_S win_T;
|
||||
int win_col_off(win_T *wp);
|
||||
extern win_T *curwin;
|
||||
]]
|
||||
|
||||
vim.cmd('set number numberwidth=4 signcolumn=yes:4')
|
||||
vim.cmd('set number numberwidth=4 signcolumn=yes:4')
|
||||
|
||||
return ffi.C.win_col_off(ffi.C.curwin)
|
||||
]=]
|
||||
return ffi.C.win_col_off(ffi.C.curwin)
|
||||
end)
|
||||
)
|
||||
|
||||
eq(
|
||||
20,
|
||||
exec_lua [=[
|
||||
local ffi = require('ffi')
|
||||
exec_lua(function()
|
||||
local ffi = require('ffi')
|
||||
|
||||
ffi.cdef[[
|
||||
ffi.cdef [[
|
||||
typedef struct {} stl_hlrec_t;
|
||||
typedef struct {} StlClickRecord;
|
||||
typedef struct {} statuscol_T;
|
||||
@@ -58,32 +58,32 @@ describe('ffi.cdef', function()
|
||||
);
|
||||
]]
|
||||
|
||||
return ffi.C.build_stl_str_hl(
|
||||
ffi.C.find_window_by_handle(0, ffi.new('Error')),
|
||||
ffi.new('char[1024]'),
|
||||
1024,
|
||||
ffi.cast('char*', 'StatusLineOfLength20'),
|
||||
-1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
nil,
|
||||
nil,
|
||||
nil
|
||||
)
|
||||
]=]
|
||||
return ffi.C.build_stl_str_hl(
|
||||
ffi.C.find_window_by_handle(0, ffi.new('Error')),
|
||||
ffi.new('char[1024]'),
|
||||
1024,
|
||||
ffi.cast('char*', 'StatusLineOfLength20'),
|
||||
-1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
nil,
|
||||
nil,
|
||||
nil
|
||||
)
|
||||
end)
|
||||
)
|
||||
|
||||
-- Check that extern symbols are exported and accessible
|
||||
eq(
|
||||
true,
|
||||
exec_lua [[
|
||||
local ffi = require('ffi')
|
||||
exec_lua(function()
|
||||
local ffi = require('ffi')
|
||||
|
||||
ffi.cdef('uint64_t display_tick;')
|
||||
ffi.cdef('uint64_t display_tick;')
|
||||
|
||||
return ffi.C.display_tick >= 0
|
||||
]]
|
||||
return ffi.C.display_tick >= 0
|
||||
end)
|
||||
)
|
||||
end)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user