Repository navigation
Conversation
set.bats now checks each section of the late set.vim after a full startup, one test per section; the Terminal Settings section is left out, since Vim in silent Ex mode loads no termcap and t_ti and t_te read empty whatever set.vim does. old-files.bats covers what xdg-settings.vim does beyond where it points Vim: the 90-day cleanup in the backup, undo, swap and view directories, the 180-day viminfo limit, everything else under the state directory left alone, and the backup and viminfo options. Each test was seen red against a changed age limit, pattern or option. Refs #71 Co-Authored-By: AI Agent <noreply@harleypig.com>
help.bats checks what the late help.vim does to a help window: it moves to a vertical split on the right, and its buffer alone gets Enter and Ctrl-[ for following a link and going back. The resize to 80 columns is left out: in silent Ex mode no window is wider than 80, so it never has anything to do. maps-rest.bats covers the maps.vim mappings no other file did: <Leader>tt's terminal split, Ctrl-L clearing search highlighting, and <Leader>fb reaching ALE's fixer. Each test was seen red against a changed mapping or autocmd. Refs #71 Co-Authored-By: AI Agent <noreply@harleypig.com>
quickfix.bats checks the late quickfixtoggle#toggle(): it opens the quickfix window and returns the cursor to the window it was called from, closes the window on a second call, and treats an open location list as no quickfix window. :QuickfixToggle and <Leader>qf both reach it, and <Leader>q] and <Leader>q[ step through the list. Each test was seen red against a broken toggle or a remapped key. Refs #71 Co-Authored-By: AI Agent <noreply@harleypig.com>
statusline-parts.bats calls the statusline's functions directly: every branch of YASL_BufferInfo() and YASL_Warnings(), YASL_FileSize() at 0, 1, 1023, 1024, 1 MiB - 1 and 1 MiB, and the statusline that joins them. gutter.bats checks gutter.vim's startup values and the sign toggle's branches tidy.bats did not reach: signs back in a column of their own with numbers off, and in the number column with only relative numbers. diagnostic-colors.bats checks the palette is applied again when a colour scheme loads. The area's colors.vim and after/diff.vim were removed in #124, so there is nothing of theirs left to test. Each test was seen red against a changed branch, boundary or setting. Refs #71 Co-Authored-By: AI Agent <noreply@harleypig.com>
ale-values.bats reads the early ale.vim's values from an autocmd that fires as ALE's own plugin file is about to load, so a value set too late reads as unset rather than as ALE's default. It also checks the late ale.vim's global linters and fixers exactly, and that opening a buffer of every filetype we have an ftplugin for, the list taken from the after/ftplugin directory, leaves them whole (#77 - one ftplugin wiped another's fixers). Each test was seen red against a changed or moved value, or an ftplugin that overwrote the globals. Refs #71 Co-Authored-By: AI Agent <noreply@harleypig.com>
ftplugins.bats reads what each after/ftplugin file not already covered in full sets in a buffer of its filetype: hcl's and terraform's comments, folds, fixer and linter; java's empty linter list, with and without google-java-format; python's two-space indent and its isort and yapf fixers in order; sh's bash syntax, fix on save and full shfmt options; vim's continuation indent; and yaml's yamllint added to a list the buffer already has, and given to an Ansible buffer. json and markdown were already covered by load.bats, ale-settings.bats and intellisense.bats. Each test was seen red against a changed setting, except terraform's comments, folds and fixer: vim-polyglot's terraform ftplugin runs our hcl.vim too, so a terraform buffer has them whether terraform.vim sets them or not. The test says so. Errors are read from the messages that reached the user rather than v:errmsg, which CI's Vim sets from its own syntax/sh.vim. Refs #71 Co-Authored-By: AI Agent <noreply@harleypig.com>
CI's Vim showed two differences from the local Vim.
It is built without +clipboard, so set.vim's clipboard line does
nothing there and the option reads empty. set.bats now checks for
unnamed only where exists('+clipboard') says the option works.
Its own syntax/sh.vim writes the errors that a silent! hides to an
active redirect, so ftplugins.bats and ale-values.bats saw errors that
were not ours. They now read errors from the message history, as
load.bats does. An error one of our ftplugins raises still turns them
red.
Refs #71
Co-Authored-By: AI Agent <noreply@harleypig.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Finishes the behaviour tests for our own settings, area by area. Each
commit covers one area of #71's checklist. Tests only: no settings file
changes, and no test found a bug.
Closes #71
Areas: which tests cover each
plugin/set.vim,plugin/xdg-settings.vim):set.bats(every section of set.vim, read after full startup),old-files.bats(new: the 90-day and 180-day cleanup, everything elseleft alone, the backup and viminfo options),
xdg.bats,tidy.batsplugin/maps.vim,plugin/help.vim):maps.bats,tidy.bats,maps-rest.bats(new:<Leader>tt, Ctrl-L,<Leader>fb),help.bats(new: help in a right-hand vertical split, its buffer-localEnter and Ctrl-[),
quickfix.bats(the<Leader>q*mappings)autoload/quickfixtoggle.vim):quickfix.bats(new:opens and returns focus, a second call closes, a lone location list is
not read as quickfix,
:QuickfixToggle,<Leader>qf,<Leader>q]and<Leader>q[)plugin/diagnostic-colors.vimincolors.batsanddiagnostic-colors.bats(new: the palette survives a colour schemeloading);
plugin/gutter.vimintidy.batsandgutter.bats(new:startup values, the sign toggle's branches with numbers off and
relative-only);
after/plugin/statusline.viminstatusline.bats,colors.batsandstatusline-parts.bats(new: each branch ofYASL_BufferInfo()andYASL_Warnings(),YASL_FileSize()at 0, 1,1023, 1024, 1 MiB - 1 and 1 MiB, the assembled statusline).
plugin/colors.vimandafter/diff.vimwere removed in Remove inert code: tools/, checkfiletype, diff, bats, virtual text, mustache #124 (after/diff.vim is never loaded: remove, move, or note #98), sothere is nothing of theirs to test.
plugin/ale.vim):ale-settings.bats,ale-linters.bats,load.bats,ale-values.bats(new: early valuesread as ALE's plugin is about to load; the late global linters and
fixers exactly; both still whole after every ftplugin's filetype has
been opened, Opening a Python or bats buffer wipes json's ALE fixer setting #77)
plugin/checkfiletype.vim): removed inRemove inert code: tools/, checkfiletype, diff, bats, virtual text, mustache #124 after checkfiletype.vim and the git ftplugin are inert: remove, make work, or note #97 found it inert, so there is nothing to test. The Ansible
detection tests in
load.batscover what detects filetypes now.after/ftplugin/): hcl, java, python,sh, terraform, vim and yaml in
ftplugins.bats(new); json inload.bats; markdown inale-settings.batsandintellisense.bats;linter names in
ale-linters.bats; sh's shfmt command insh-ftplugin.bats; python's and yaml's other cases intidy.batsandload.batsafter/plugin/helptags.vim):helptags.batsTwo lines are left untested, because silent Ex mode cannot show them:
t_ti=andt_te=. Vim in-esloads no termcap, so bothread empty whatever set.vim does.
set.bats's header says so.-esno window is widerthan 80 columns, whatever
columnsis set to, so the resize never hasanything to do.
help.bats's header says so.Test plan
bats tests/vimwith a fresh, emptyTMPDIR: 146 tests, all ok, andthe directory was still empty afterwards.
settings file was changed (a value, a boundary, a branch condition, a
mapping target, or the line deleted), the file was run, and the
settings file was put back. Each change turned the expected test red.
The exception is in the next section.
bats tests/vimon Ubuntu 24.04's Vim 9.1.0016) failed on thefirst push because of two ways CI's Vim differs from the local one. It
has no
+clipboard, so set.vim's clipboard line does nothing there.Its own
syntax/sh.vimalso writes the errors asilent!hides into anactive redirect. The last commit fixes both: the clipboard check runs
only where
exists('+clipboard'), and errors are read from the messagehistory, as
load.batsreads them. CI is now green.Testing evaluation
Done by the agent that opened this PR, to the qa-tester's standard. No
team-managed:sentinel is declared.tests/vim/.guards (see Test plan). One case does not have that falsifier:
terraform's
commentstring,foldmethodandb:ale_fixers. Deletingthem from
terraform.vimleaves the test green, becausevim-polyglot's terraform ftplugin runs
runtime! ftplugin/hcl.vim,which also sources our
after/ftplugin/hcl.vim. The test asserts what aterraform buffer ends up with and says where the values come from. The
tflint linter does come only from terraform.vim, and deleting it turns
the test red.
:normalon theirkeys, the toggle through its function, its command and its mapping, and
the early ALE values through an autocmd that fires as ALE's own plugin
file loads.
Manual verification
(
git submodule update --init) andBATS_LIB_PATHpointing atbats-support and bats-assert.
bats tests/vim.ok, the last test is number 146, andthe exit status is 0.
textwidth=78totextwidth=80in the lateplugin/set.vim. Runbats tests/vim/set.batsandnot ok 6 wrapping: …appears.What happened: step 2 printed
1..146, every lineok, exit status0. Step 4 printed
not ok 6 wrapping: format options, backspace over everything, 78 columns, and afterset.vimwas restored the file rangreen.
Review
The diff was reviewed by its author: each test was checked to read what
the settings file sets rather than what Vim or a plugin does with it
(
.claude/TESTS.md), to fail on a broken setting, and not to depend onthe local Vim. Tests that open sh or java buffers read errors from the
message history, as
load.batsdoes. They do not readv:errmsgor theredirect, because CI's Vim fills both from its own
syntax/sh.vim.opt-out: no review skill ran. The diff adds tests and changes no
settings, and each test was checked by breaking the line it guards and
seeing it go red, which covers what a diff review would look for here.
Completion report
watched on this PR.
local editor configuration.
cannot exercise are named above.
and which other files cover the rest.
.claude/TESTS.mdneeds nochange.
Co-Authored-By: AI Agent noreply@harleypig.com