summaryrefslogtreecommitdiffstatshomepage
path: root/test/functional/lua/version_spec.lua
AgeCommit message (Collapse)AuthorFiles
2026-04-08feat(vim.version): add __eq to vim.VersionRange #38881ngicks1
Problem: vim.VersionRange had no __eq metamethod, so comparing 2 distinct but same value instances always returned false. In vim.pack.add this caused redundant lockfile rewrites, even when the resulting lockfile content was unchanged. Solution: Add __eq metamethod on vim.VersionRange
2025-06-30feat(vim.version): add `vim.version.intersect()`Evgeni Chasnovski1
Problem: No way to compute intersection of two version ranges, which is useful when computing version range that fits inside several reference ranges. Solution: Add `vim.version.intersect()`.
2025-06-30fix(vim.version): improve construction of '<=a.b.c' and '>a.b.c' rangesEvgeni Chasnovski1
Problem: `vim.version.range('<=a.b.c')` is not precise when it comes to its right hand side. This is due to version ranges using exclusive right hand side. While `vim.version.range('>a.b.c')` is not precise when it comes to its left hand side because left hand sides are inclusive. Solution: For '>=a.b.c' increase `to` from 'a.b.c' to the smallest reasonable version that is bigger than 'a.b.c'. For '<a.b.c' do the same for `from`. More proper solution is an explicit control over inclusivity of version range sides, but it has more side effects and requires design decisions.
2025-06-30feat(vim.version): make `tostring()` return human-readable version rangeEvgeni Chasnovski1
Problem: `tostring()` applied to version range doesn't return human-readable text with information about the range. Solution: Add `__tostring()` method.
2025-04-11fix(vim.version): vim.VersionRange:has(<prerelease>) (#33324)Phạm Bình An1
Problem: `vim.version.range('>=0.10'):has('0.12.0-dev')` returns false, which is wrong per semver. Solution: `vim.VersionRange:has()` shouldn't have special handling for prereleases (Why would we need it when `__eq`, `__lt`, `__le` already handle prereleases?). Closes #33316
2024-07-27fix(version): return nil with empty stringMaria José Solano1
2024-04-23test: improve test conventionsdundargoc1
Specifically, functions that are run in the context of the test runner are put in module `test/testutil.lua` while the functions that are run in the context of the test session are put in `test/functional/testnvim.lua`. Closes https://github.com/neovim/neovim/issues/27004.
2024-04-10refactor(test): inject after_each differentlyLewis Russell1
2024-04-08test: improve test conventionsdundargoc1
Work on https://github.com/neovim/neovim/issues/27004.
2024-04-04test: reduce `exec_lua` callsdundargoc1
`exec_lua` makes code slighly harder to read, so it's beneficial to remove it in cases where it's possible or convenient. Not all `exec_lua` calls should be removed even if the test passes as it changes the semantics of the test even if it happens to pass. From https://github.com/neovim/neovim/pull/28155#discussion_r1548185779: "Note for tests like this, which fundamentally are about conversion, you end up changing what conversion you are testing. Even if the result happens to be same (as they often are, as we like the rules to be consistent if possible), you are now testing the RPC conversion rules instead of the vim script to in-process lua conversion rules." From https://github.com/neovim/neovim/pull/28155#discussion_r1548190152: "A test like this specifies that the cursor is valid immediately and not after a separate cycle of normal (or an other input-processing) mode."
2024-01-21feat(vim.version): add `vim.version.le` and `vim.version.ge`Jongwook Choi1
- Problem: One cannot easily write something like, for example: `version_current >= {0, 10, 0}`; writing like `not vim.version.lt(version_current, {0, 10, 0})` is verbose. - Solution: add {`le`,`ge`} in addition to {`lt`,`gt`}. - Also improve typing on the operator methods: allow `string` as well. - Update the example in `vim.version.range()` docs: `ge` in place of `gt` better matches the semantics of `range:has`.
2024-01-03refactor: format test/*Justin M. Keyes1
2023-06-12feat: tostring(vim.version())Justin M. Keyes1
Problem: tostring(vim.version()) returns "table: 0x…". Solution: Modify vim.version() to return a string prerelease instead of a boolean. Fix #23863
2023-06-06fix: version-range < and <= #23539Gianmaria Bajo1
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())
2023-03-22fix(vim.version): prerelease compareJustin M. Keyes1
Problem: semver specifies that digit sequences in a prerelease string should be compared as numbers, not lexically: https://semver.org/#spec-item-11 > Precedence for two pre-release versions with the same major, minor, > and patch version MUST be determined by comparing each dot separated > identifier from left to right until a difference is found as follows: > 1. Identifiers consisting of only digits are compared numerically. > 2. Identifiers with letters or hyphens are compared lexically in ASCII sort order. > 3. Numeric identifiers always have lower precedence than non-numeric identifiers. > 4. A larger set of pre-release fields has a higher precedence than a smaller set, if all of the preceding identifiers are equal. Example: 1.0.0-alpha < 1.0.0-alpha.1 < 1.0.0-alpha.beta < 1.0.0-beta < 1.0.0-beta.2 < 1.0.0-beta.11 < 1.0.0-rc.1 < 1.0.0. Solution: cmp_prerel() treats all digit sequences in a prerelease string as numbers. This doesn't _exactly_ match the spec, which specifies that only dot-delimited digit sequences should be treated as numbers...
2023-03-20feat(vim.version): more coercion with strict=falseJustin M. Keyes1
Problem: "tmux 3.2a" (output from "tmux -V") is not parsed easily. Solution: With `strict=false`, discard everything before the first digit. - rename Semver => Version - rename vim.version.version() => vim.version._version() - rename matches() => has() - remove `opts` from cmp()
2023-03-20refactor(vim.version): use lazy.nvim semver moduleJustin M. Keyes1
Now the Nvim version string "v0.9.0-dev-1233+g210120dde81e" parses correctly.
2023-03-20refactor(vim.version): use lazy.nvim semver moduleJustin M. Keyes1
Use semver code from https://github.com/folke/lazy.nvim License: Apache License 2.0 Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>
2023-03-06fix(vim.version): incorrect version.cmp()Justin M. Keyes1
Problem: If major<major but minor>minor, cmp_version_core returns 1 Solution: - Fix logic in cmp_version_core - Delete most eq()/gt()/lt() tests, they are redundant.
2023-03-06refactor(vim.version): cleanupJustin M. Keyes1
- version.cmp(): assert valid version - add test for loading vim.version (the other tests use shared.lua in the test runner) - reduce test scopes, reword test descriptions
2023-03-06feat(lua): add semver apiKelly Lin1