diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2023-06-12 01:14:33 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2023-06-12 01:14:33 +0200 |
commit | e6887932539315e02621edb77d5e77c7c2a0b033 (patch) | |
tree | d3c053756e9ba69f63787737039de228584d2cd5 /test/functional/lua/version_spec.lua | |
parent | ecdb6465e272119f80f3b68a6695e0f74b02ca49 (diff) | |
download | rneovim-e6887932539315e02621edb77d5e77c7c2a0b033.tar.gz rneovim-e6887932539315e02621edb77d5e77c7c2a0b033.tar.bz2 rneovim-e6887932539315e02621edb77d5e77c7c2a0b033.zip |
feat: tostring(vim.version())
Problem:
tostring(vim.version()) returns "table: 0x…".
Solution:
Modify vim.version() to return a string prerelease instead of a boolean.
Fix #23863
Diffstat (limited to 'test/functional/lua/version_spec.lua')
-rw-r--r-- | test/functional/lua/version_spec.lua | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/functional/lua/version_spec.lua b/test/functional/lua/version_spec.lua index 64dcbec983..d1c981c388 100644 --- a/test/functional/lua/version_spec.lua +++ b/test/functional/lua/version_spec.lua @@ -17,6 +17,18 @@ describe('version', function() eq({ major = 42, minor = 3, patch = 99 }, exec_lua("return vim.version.parse('v42.3.99')")) end) + it('version() returns Nvim version', function() + local expected = exec_lua('return vim.fn.api_info().version') + local actual = exec_lua('return vim.version()') + eq(expected.major, actual.major) + eq(expected.minor, actual.minor) + eq(expected.patch, actual.patch) + eq(expected.prerelease and 'dev' or nil, actual.prerelease) + + -- tostring() #23863 + matches([[%d+%.%d+%.%d+]], exec_lua('return tostring(vim.version())')) + end) + describe('_version()', function() local tests = { ['v1.2.3'] = { major = 1, minor = 2, patch = 3 }, |