Files
LLeMbas-IDE/scripts/test-nvim.sh
T
HomerandClaude Opus 5.5 2b1d42b976 Neovim plugin: only project files go along, the shared rules held by shared cases, review fixes
Privacy: pieces of other open files with a suggestion, and the names of other open files with a
message, now come only from files inside the working directory, never from a file that looks
like it holds secrets (one table, tests/rules/private_files.json, which the VS Code extension
reads too), and never from one the project's .gitignore leaves out. In a file that looks secret
no suggestion is asked for; said once. :help llembas-privacy says what is and is not sent.

- require("llembas").cli(): the one function that decides where the LLeMbas CLI is (PATH, then
  ~/.local/bin); LLeMbas IDE and its launcher follow it.
- A late answer from an agent that was replaced (:LLeMbasNew!, :LLeMbasRestart) no longer ends
  the new turn.
- :LLeMbasOpen judges a file by its first bytes and its name (llembas.shown), as VS Code does.
- The existing sign-in is read by whole lines; an address that reads as an option is refused.
- A protocol line over the limit is dropped whole, not the message after it; a notification
  that fails is noted in :LLeMbasLog.
- After :cd the remembered settings of the new directory hold.
- Versions: "1.2.3junk" is no version, as in VS Code.
- tests/rules/: versions, private files, server addresses, sign-in lines, protocol lines and
  openable files, as data both editors' suites read (scripts/test-nvim.sh rules).
- The stand-in agent answers _lembas/session/delete as the CLI does ({deleted}, no notification
  on serve --stdio).
- Texts: one sentence for "still working" and one for "this CLI is too old"; plain words in
  :LLeMbasStatus and the length presets; the help card is "LLeMbas — commands and keys".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 07:52:14 +00:00

39 lines
1.9 KiB
Bash
Executable File

#!/bin/sh
# The Neovim plugin's tests: headless, against the stand-in agent (tests/fake_agent.py) and, when its
# source is at hand, the LLeMbas CLI itself. Needs nvim 0.10+ and python3.
#
# scripts/test-nvim.sh all of them
# scripts/test-nvim.sh rules the rules both editors keep, against tests/rules/
# scripts/test-nvim.sh plugin the plugin on its own: chat, rewrite, suggestions, sign-in
# scripts/test-nvim.sh layout the bars: top, bottom, tree, right bar, keys, what is remembered
#
# Nothing of this machine's own Neovim is read or written: the state, data, cache and configuration
# directories are temporary ones, removed on every way out.
set -eu
cd "$(dirname "$0")/.."
WORK="$(mktemp -d "${TMPDIR:-/tmp}/llembas-nvim-test.XXXXXX")"
trap 'rm -rf "$WORK"' EXIT
trap 'exit 130' INT
trap 'exit 143' TERM
mkdir -p "$WORK/state" "$WORK/data" "$WORK/cache" "$WORK/config"
export XDG_STATE_HOME="$WORK/state" XDG_DATA_HOME="$WORK/data" XDG_CACHE_HOME="$WORK/cache" XDG_CONFIG_HOME="$WORK/config"
export LLEMBAS_NVIM_TEST_WORK="$WORK"
# The terminal these tests run in says nothing about itself to the plugin.
unset LLEMBAS_TERM LLEMBAS_TTY TMUX STY ZELLIJ KITTY_WINDOW_ID GHOSTTY_RESOURCES_DIR TERM_PROGRAM
export TERM=dumb
which="${1:-all}"
status=0
if [ "$which" = all ] || [ "$which" = rules ]; then
# The rules both editors keep, against the shared cases in tests/rules/.
nvim --headless -u NONE -i NONE --cmd "set rtp+=nvim" -l nvim/tests/rules.lua || status=$?
fi
if [ "$which" = all ] || [ "$which" = plugin ]; then
nvim --headless -u NONE -i NONE --cmd "set rtp+=nvim" -l nvim/tests/run.lua || status=$?
fi
if [ "$which" = all ] || [ "$which" = layout ]; then
# With a screen (no -l): the bars are read from what is drawn.
nvim --headless -u NONE -i NONE --cmd "set rtp+=nvim" -c "luafile nvim/tests/layout.lua" || status=$?
fi
exit "$status"