test: port libvterm unit test to neovim test suite

These were imported from the v0.3.3 git tag
https://github.com/neovim/libvterm/tree/v0.3.3 and not the latest
commit. This is for compatibility reasons as the libvterm code was
imported from v0.3.3.
This commit is contained in:
dundargoc
2024-09-25 16:07:37 +02:00
committed by dundargoc
parent 07b4cb6ada
commit 4c25e60767
7 changed files with 4146 additions and 2 deletions

View File

@@ -5,6 +5,7 @@ for p in ("${TEST_INCLUDE_DIRS}" .. ";"):gmatch("[^;]+") do
table.insert(M.include_paths, p)
end
M.vterm_test_file = "${VTERM_TEST_FILE}"
M.test_build_dir = "${CMAKE_BINARY_DIR}"
M.test_source_path = "${CMAKE_SOURCE_DIR}"
M.test_lua_prg = "${LUA_PRG}"

View File

@@ -151,6 +151,13 @@ local function filter_complex_blocks(body)
or string.find(line, 'mach_vm_range_recipe')
)
then
-- HACK: remove bitfields from specific structs as luajit can't seem to handle them.
if line:find('struct VTermState') then
line = string.gsub(line, 'state : 8;', 'state;')
end
if line:find('VTermStringFragment') then
line = string.gsub(line, 'size_t.*len : 30;', 'size_t len;')
end
result[#result + 1] = line
end
end

3591
test/unit/vterm_spec.lua Normal file

File diff suppressed because it is too large Load Diff