fix: version-range < and <= #23539

vim.version.range() couldn't parse them correctly.
For example, vim.version.range('<0.9.0'):has('0.9.0') returned `true`.

fix: range:has() accepts vim.version()
So that it's possible to compare a range with:

    vim.version.range(spec):has(vim.version())
This commit is contained in:
Gianmaria Bajo
2023-06-06 15:38:45 +02:00
committed by GitHub
parent f5d12889e8
commit ca887b80a9
3 changed files with 26 additions and 7 deletions

View File

@@ -40,6 +40,8 @@ describe('version', function()
['=1.2.3'] = { from = { 1, 2, 3 }, to = { 1, 2, 4 } },
['>1.2.3'] = { from = { 1, 2, 4 } },
['>=1.2.3'] = { from = { 1, 2, 3 } },
['<1.2.3'] = { from = { 0, 0, 0 }, to = { 1, 2, 3 } },
['<=1.2.3'] = { from = { 0, 0, 0 }, to = { 1, 2, 4 } },
['~1.2.3'] = { from = { 1, 2, 3 }, to = { 1, 3, 0 } },
['^1.2.3'] = { from = { 1, 2, 3 }, to = { 2, 0, 0 } },
['^0.2.3'] = { from = { 0, 2, 3 }, to = { 0, 3, 0 } },