summaryrefslogtreecommitdiffstatshomepage
path: root/test/functional/ex_cmds/write_spec.lua
AgeCommit message (Collapse)AuthorFiles
2026-04-22ci: drop cirrus #39321Justin M. Keyes1
Problem: cirrus will shutdown soon, and we are running out of minutes anyway, which causes ci failures. Solution: Drop cirrus config.
2026-04-22fix(cmd): ++p, ++edit should match "word" boundary #39146glepnir1
Problem: `:write ++patate foo` doesn't error out, instead it turns on mkdir_p and uses "atate foo" as the filename. Same with ++edit. The parser just does strncmp without checking what comes after. Solution: require the next char after the option name to not be a letter
2026-04-20refactor(test): drop deprecated exc_exec #39242Justin M. Keyes1
2026-02-19test(ex_cmds/write_spec): don't create files under test/ (#37963)zeertzjq1
2026-02-12fix(bufwrite.c): handle invalid byte sequences #37363Kevin Goodsell1
Problem: bw_rest was used as an extra buffer to save incomplete byte sequences between calls to buf_write_bytes. Besides being unnecessarily complicated, this introduced a number of issues: 1) The bytes stored in bw_rest could still be there at the end of writing the file, never having been written, thus losing some of the file content on write. 2) bw_rest was not cleared out after the "checking_conversion" phase, leaving them to affect the written file content during the writing phase, corrupting the file. 3) bw_rest could contain extra bytes that need to be written to the output buffer during a buf_write_convert call, potentially before any bytes are consumed. But some conversions are in-place, without a separate output buffer. Writing bytes from bw_rest to the "output" buffer actually overwrote bytes from the input buffer before they were read, corrupting the data to be written. 4) The extra bytes in bw_rest that need to be written to the conversion output buffer were not originally accounted for in the size calculation for the output buffer, causing a buffer overflow (previously fixed in Vim patch 9.1.2028). Solution: Rather than maintaining a separate buffer, the unconverted bytes at the end of the buffer can just be shifted to the beginning of the buffer, and the buffer size updated. This requires a bit of refactoring, and buf_write_convert and buf_write_convert_with_iconv need to report the number of bytes they consumed so that buf_write_bytes can handle the remaining bytes. Following conversion, bw_buf can be checked for any remaining bytes. Leftover bytes in this case result in a conversion error, which is better than silently dropping them. A short section of dead code was removed from buf_write_convert, for converting a non-UTF-8 buffer to UTF-8. Neovim buffers are always UTF-8. A few additional tests for iconv conversions have been added. Vim's iconv tests are disabled in Neovim because they use unsupported values for 'encoding'.
2025-10-11feat: ":wall ++p" creates parent dirs for each buf #36121Rob Pilling1
`:wall ++p` will create parent directories if they do not exist, for each modified buffer
2025-09-27fix(cmd): :update writes new file buffers only for real files #35939glepnir1
Problem: :update should write new file buffers, but previous fix affected special buffer types (acwrite, nofile, etc.). Solution: Add bt_nofilename() check to only write new files for buffers representing real filesystem paths.
2025-09-27fix(cmd): :update does not write new, unmodified buffer #35929glepnir1
Problem: update command does not write new buffers that have filenames but no corresponding file on disk, even when using ++p flag. Solution: allow update to write when buffer has filename but file doesn't exist.
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-01-12test: rename (meths, funcs) -> (api, fn)Lewis Russell1
2024-01-12test: typing for helpers.methsLewis Russell1
2024-01-12test: use vim.mpack and vim.uv directlyLewis Russell1
2024-01-03refactor: format test/*Justin M. Keyes1
2023-05-21refactor(options): deprecate nvim[_buf|_win]_[gs]et_optionLewis Russell1
Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: famiu <famiuhaque@protonmail.com>
2023-04-04test: replace lfs with luv and vim.fsdundargoc1
test: replace lfs with luv luv already pretty much does everything lfs does, so this duplication of dependencies isn't needed.
2022-11-22test: simplify platform detection (#21020)dundargoc1
Extend the capabilities of is_os to detect more platforms such as freebsd and openbsd. Also remove `iswin()` helper function as it can be replaced by `is_os("win")`.
2022-11-13test: introduce skip() #21010dundargoc1
This is essentially a convenience wrapper around the `pending()` function, similar to `skip_fragile()` but more general-purpose. Also remove `pending_win32` function as it can be replaced by `skip(iswin())`.
2022-11-06feat: ":write ++p" creates parent dirs #20835Victor Blanchard1
- `:write ++p foo/bar/baz.txt` should create parent directories `foo/bar/` if they do not exist - Note: `:foo ++…` is usually for options. No existing options have a single-char abbreviation (presumably by design), so it's safe to special-case `++p` here. - Same for `writefile(…, 'foo/bar/baz.txt', 'p')` - `BufWriteCmd` can see the ++p flag via `v:cmdarg`. closes #19884
2022-10-17ci: add cirrus to isCI function to skip tests (#20526)dundargoc1
The environment variable CIRRUS_CI is manually passed to RunTests.cmake as it doesn't get passed when using cmake script mode.
2022-09-08ci: move BSD jobs from sourcehut to Cirrus CI #19616dundargoc1
dispatch.sr.ht is being deprecated, meaning that using sourcehut CI won't be possible (see https://github.com/neovim/neovim/issues/19609). Since Github Actions doesn't provide any BSD runners an external service is required and Cirrus CI seems like a good replacement for sourcehut. Initially experimented with using FreeBSD and OpenBSD virtual machines in GitHub Actions, but Cirrus has been a much better fit with better performance, logs and overall experience. Failing tests are automatically skipped on FreeBSD regardless if it's on CI or not. Ideally these tests should only be skipped in CI with the help of `isCI` helper function. Unfortunately, the tests don't recognize the environment variable CIRRUS_CI even if it's set manually. This workaround is good enough for the time being, but we might want to only skip tests when using the CI (or even better, fix the failing tests). Closes: https://github.com/neovim/neovim/issues/19609
2021-09-19refactor(tests): remove redir_exec #15718Justin M. Keyes1
Problem - `redir_exec` is obsolete, but it keeps getting used in new tests because people copy existing tests. - Disadvantages of `redir_exec`: - Captures extra junk before the actual error/message that we _want_ to test. - Does not fail on error, unlike e.g. `command()`. Solution - Use new functions like `nvim_exec` and `pcall_err`.
2019-10-18tests: fix non-controversial misuse of `pending` (#11247)Daniel Hahler1
Ref: https://github.com/neovim/neovim/pull/11184
2018-05-25fixup: always delete Xfile, fix exit code checkJan Edmund Lazo1
after_each + os.remove ensures Xfile is deleted after every test. Windows exit code is inconsistent.
2018-05-24win: test: don't test symlink if not admin userJan Edmund Lazo1
2018-05-24win: test: disable non-admin failing testsJan Edmund Lazo1
mkfifo (msysgit) does not work outside of msys2 environment. gzip tests fail on Windows. mklink requires admin privs for file symbolic links so mklink fails.
2018-02-19Resolve issues mentioned in PR reviewJan Edmund Lazo1
2018-02-19test: enable ex_cmds/write_spec.lua in WindowsJan Edmund Lazo1
2017-04-09functests: Fix linter errorsZyX1
2017-04-09functests: Replace execute with either command or feed_commandZyX1
Hope this will make people using feed_command less likely: this hides bugs. Already found at least two: 1. msgpackparse() will show internal error: hash_add() in case of duplicate keys, though it will still work correctly. Currently silenced. 2. ttimeoutlen was spelled incorrectly, resulting in option not being set when expected. Test was still functioning somehow though. Currently fixed.
2017-04-03functests: Test some :write errorsZyX1
2016-10-21os_nodetype: open fd with O_NONBLOCK (#5515)Justin M. Keyes1
Closes #5267 Helped-by: oni-link <knil.ino@gmail.com>
2016-08-26Mark some functional tests as pending in WindowsRui Abreu Ferreira1
2016-06-23test: fix command_count_specBjörn Linse1
The test hit wait_return if x or .x.swp exists in the project root directory.
2016-06-15test: functional: Remove test_bkc_* files after testingJames McCoy1
2016-06-10functests: Check logs in lua codeZyX1
It is otherwise impossible to determine which test failed sanitizer/valgrind check. test/functional/helpers.lua module return was changed so that tests which do not provide after_each function to get new check will automatically fail.
2016-04-28Remove old UNIX ifdef from buf_write()Rui Abreu Ferreira1
When backupcopy=auto buf_write assumes backupcopy=yes when the file is a hard/symbolic link. However this check was guarded by a UNIX ifdef. The check itself is portable and the guard can be removed. Added a couple tests to check the behaviour of bkc=auto and bkc=no with a symbolic link. Reported in #4525