aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/iter_spec.lua
Commit message (Collapse)AuthorAge
* fix(vim.iter): enable optimizations for arrays (lists with holes) (#28781)Gregory Anders2024-05-17
| | | | | | | | The optimizations that vim.iter uses for array-like tables don't require that the source table has no holes. The only thing that needs to change is the determination if a table is "list-like": rather than requiring consecutive, integer keys, we can simply test for (positive) integer keys only, and remove any holes in the original array when we make a copy for the iterator.
* refactor(vim.iter)!: rename xxback() => rxx() #28503Justin M. Keyes2024-04-26
| | | | | | | | | | | | | | | | Problem: vim.iter has both `rfind()` and various `*back()` methods, which work in "reverse" or "backwards" order. It's inconsistent to have both kinds of names, and "back" is fairly uncommon (rust) compared to python (rfind, rstrip, rsplit, …). Solution: - Remove `nthback()` and let `nth()` take a negative index. - Because `rnth()` looks pretty obscure, and because it's intuitive for a function named `nth()` to take negative indexes. - Rename `xxback()` methods to `rxx()`. - This informally groups the "list-iterator" functions under a common `r` prefix, which helps discoverability. - Rename `peekback()` to `pop()`, in duality with the existing `peek`.
* test: improve test conventionsdundargoc2024-04-23
| | | | | | | | | 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.
* refactor(test): inject after_each differentlyLewis Russell2024-04-10
|
* test: improve test conventionsdundargoc2024-04-08
| | | | Work on https://github.com/neovim/neovim/issues/27004.
* fix(vim.iter): use correct cmp function when truncating tail in `take` (#27998)Calvin Bochulak2024-03-23
|
* feat(vim.iter): add Iter:flatten (#26786)JD2024-01-10
| | | | | Co-authored-by: Gregory Anders <greg@gpanders.com> Co-authored-by: Jongwook Choi <wookayin@gmail.com>
* refactor: format test/*Justin M. Keyes2024-01-03
|
* feat(iter): add `Iter.take` (#26525)Will Hopkins2023-12-12
|
* feat(lua): implement Iter:join() (#26416)Gregory Anders2023-12-05
|
* fix(iter): make pipeline termination conditions consistent (#24614)Gregory Anders2023-08-09
| | | | | | | | If an iterator pipeline stage returns nil as its first return value, the other return values are ignored and it is treated as if that stage returned only nil (the semantics of returning nil are different between different stages). This is consistent with how for loops work in Lua more generally, where the for loop breaks when the first return value from the function iterator is nil (see :h for-in for details).
* feat(lua): use callable table as iterator in vim.iter (#23957)Mathias Fußenegger2023-06-10
| | | | A table passed to `vim.iter` can be a class instance with a `__call` implementation for the iterator protocol.
* test: move vim.iter tests to separate fileGregory Anders2023-04-24