diff options
author | Lewis Russell <lewis6991@gmail.com> | 2022-09-20 11:15:32 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-20 11:15:32 +0100 |
commit | abe2d90693e5cec3428c0162c48f0ea38972ff31 (patch) | |
tree | cdba6ac16a0da7daffa1037d83e0324c0f1045a4 /test | |
parent | e76215830522f75dea1495a0de38933d18954eca (diff) | |
download | rneovim-abe2d90693e5cec3428c0162c48f0ea38972ff31.tar.gz rneovim-abe2d90693e5cec3428c0162c48f0ea38972ff31.tar.bz2 rneovim-abe2d90693e5cec3428c0162c48f0ea38972ff31.zip |
feat(lua): move compat module from runtime to test (#20257)
Diffstat (limited to 'test')
-rw-r--r-- | test/compat.lua | 12 | ||||
-rw-r--r-- | test/helpers.lua | 2 |
2 files changed, 13 insertions, 1 deletions
diff --git a/test/compat.lua b/test/compat.lua new file mode 100644 index 0000000000..2c9786d491 --- /dev/null +++ b/test/compat.lua @@ -0,0 +1,12 @@ +-- Lua 5.1 forward-compatibility layer. +-- For background see https://github.com/neovim/neovim/pull/9280 +-- +-- Reference the lua-compat-5.2 project for hints: +-- https://github.com/keplerproject/lua-compat-5.2/blob/c164c8f339b95451b572d6b4b4d11e944dc7169d/compat52/mstrict.lua +-- https://github.com/keplerproject/lua-compat-5.2/blob/c164c8f339b95451b572d6b4b4d11e944dc7169d/tests/test.lua + +local lua_version = _VERSION:sub(-3) + +if lua_version >= '5.2' then + unpack = table.unpack -- luacheck: ignore 121 143 +end diff --git a/test/helpers.lua b/test/helpers.lua index 499b91488b..a7eda60f87 100644 --- a/test/helpers.lua +++ b/test/helpers.lua @@ -1,4 +1,4 @@ -require('vim.compat') +require('test.compat') local shared = require('vim.shared') local assert = require('luassert') local luv = require('luv') |