From 51961625402b28ce09c863bb94bcaff63f0a1c4e Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Thu, 20 Nov 2025 01:29:39 -0500 Subject: feat(version): support multiple Vim versions Group up to 15 vimpatch numbers in 1 line to guard against 'make formatc'. 1-liner for vim_versions, num_patches. Automate '*Version' to remove version.h macros. '-V1 -v' lists merged Vim versions. --- test/functional/vimscript/has_spec.lua | 35 ++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'test/functional/vimscript/has_spec.lua') diff --git a/test/functional/vimscript/has_spec.lua b/test/functional/vimscript/has_spec.lua index 5acdbabc7b..3d8f626eea 100644 --- a/test/functional/vimscript/has_spec.lua +++ b/test/functional/vimscript/has_spec.lua @@ -104,4 +104,39 @@ describe('has()', function() fn.has('python3') -- use a call whose implementation shells out eq(73, fn.eval('v:shell_error')) end) + + it('"patch[0-9]\\+"', function() + eq(1, fn.has('patch0')) + eq(1, fn.has('patch1')) + end) + + it('"patch-x.y.z"', function() + -- versions older than current v:version always succeed + -- unless minor version has 2+ digits + eq(1, fn.has('patch-7.4.0')) + eq(0, fn.has('patch-7.40.0')) + eq(1, fn.has('patch-8.0.0')) + eq(0, fn.has('patch-8.00.0')) + + eq(1, fn.has('patch-8.1.0')) + eq(1, fn.has('patch-8.1.1')) + eq(1, fn.has('patch-8.1.0001')) + eq(1, fn.has('patch-8.1.1939')) + eq(1, fn.has('patch-8.1.2424')) + + eq(0, fn.has('patch-8.2.0')) + eq(1, fn.has('patch-8.2.1')) + eq(1, fn.has('patch-8.2.2999')) + eq(1, fn.has('patch-8.2.5171')) + + eq(0, fn.has('patch-9.0.0')) + eq(1, fn.has('patch-9.0.1')) + eq(1, fn.has('patch-9.0.998')) + eq(1, fn.has('patch-9.0.2190')) + + eq(0, fn.has('patch-9.1.0')) + eq(1, fn.has('patch-9.1.1')) + eq(1, fn.has('patch-9.1.690')) + eq(1, fn.has('patch-9.1.1934')) + end) end) -- cgit