ide: test typing, a person's own plugin and a custom prefix
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
4 files changed
+69
-6
No files matched your search
+25
-3
@@ -108,6 +108,11 @@ headless() {
|
||||
IDE_TEST_BG_LIGHT="$BG_LIGHT" "$@" timeout 120 "$home/.local/bin/llembas-ide" --headless \
|
||||
-c "luafile $REPO/ide/tests/headless.lua" 2>&1)
|
||||
}
|
||||
typing() { # the completion menu, through the launcher
|
||||
local home="$1" out
|
||||
out="$( (cd "$WORK" && as "$home" timeout 60 "$home/.local/bin/llembas-ide" --headless -c "luafile $REPO/ide/tests/typing.lua" 2>&1) || true)"
|
||||
if grep -q -F 'ide-typing: the menu opens' <<<"$out"; then ok "$2"; else fail "$2" "$out"; fi
|
||||
}
|
||||
report_headless() { # report_headless "name" "output"
|
||||
local line
|
||||
line="$(grep -o -E 'ide-headless: [0-9]+ passed, 0 failed.*' <<<"$2" || true)"
|
||||
@@ -210,6 +215,7 @@ expect "--version: the IDE" "$out" "LLeMbas IDE $VERSION"
|
||||
expect "--version: Neovim" "$out" "Neovim $("$SYSTEM_NVIM" --version | sed -n '1s/^NVIM v//p')"
|
||||
expect "--version: the plugin" "$out" "LLeMbas plugin $VERSION"
|
||||
report_headless "headless start, from the inside" "$(headless "$A" 0 IDE_TEST_FIRST=1 || true)"
|
||||
typing "$A" "typing: the completion menu opens with the buffer's words, and <Tab> stays LLeMbas's"
|
||||
attempt as "$A" "$A/.local/bin/llembas-ide" doctor
|
||||
out="$OUT"
|
||||
passes "doctor finds the installation sound"
|
||||
@@ -225,6 +231,9 @@ expect "arguments go through to Neovim" "$out" "llembas-ide some-file.txt"
|
||||
# --- 4. again: an update in place --------------------------------------------------------------
|
||||
echo "Installing again"
|
||||
echo 'vim.g.llembas_ide_test_user = 42' >>"$A/.config/llembas-ide/lua/user/init.lua"
|
||||
# A plugin of the person's own, in the directory the README names.
|
||||
mkdir -p "$A/.config/llembas-ide/pack/user/start/mine/plugin"
|
||||
echo 'vim.g.llembas_ide_test_plugin = "loaded"' >"$A/.config/llembas-ide/pack/user/start/mine/plugin/mine.lua"
|
||||
user_before="$(sha256sum "$A/.config/llembas-ide/lua/user/init.lua")"
|
||||
attempt installer "$A" --from-checkout --nvim-bin "$SYSTEM_NVIM" --no-parsers
|
||||
out="$OUT"
|
||||
@@ -351,6 +360,7 @@ passes "installs from the release, with the pinned Neovim downloaded and the gra
|
||||
expect "the installed Neovim is the pinned one" "$out" "Neovim $(cat ide/neovim.version)"
|
||||
check "it is the IDE's own copy" test -x "$B/.local/share/llembas-ide/nvim/bin/nvim"
|
||||
report_headless "headless start on the pinned Neovim with compiled grammars" "$(headless "$B" 1 IDE_TEST_FIRST=1 || true)"
|
||||
typing "$B" "typing on the pinned Neovim: the completion menu opens, and <Tab> stays LLeMbas's"
|
||||
attempt as "$B" "$B/.local/bin/llembas-ide" doctor
|
||||
out="$OUT"
|
||||
passes "doctor finds it sound"
|
||||
@@ -380,13 +390,25 @@ if [ "$QUICK" != 1 ]; then
|
||||
expect "and the compiled grammars" "$out" "compiled Treesitter grammars (already installed, same pins)"
|
||||
fi
|
||||
|
||||
# --- 8. uninstalling ---------------------------------------------------------------------------
|
||||
# --- 8. somewhere else: --prefix -----------------------------------------------------------------
|
||||
echo "A prefix of the person's choosing"
|
||||
D="$WORK/d"
|
||||
mkdir -p "$D"
|
||||
attempt installer "$D" --from-checkout --nvim-bin "$SYSTEM_NVIM" --no-parsers --prefix "$WORK/opt/my ide"
|
||||
passes "installs into a directory with a space in its name"
|
||||
check "the IDE is there and not in the default place" test -d "$WORK/opt/my ide/lib" -a ! -e "$D/.local/share/llembas-ide"
|
||||
check "doctor is content" as "$D" "$D/.local/bin/llembas-ide" doctor
|
||||
attempt as "$D" "$D/.local/bin/llembas-ide" uninstall --purge --yes
|
||||
passes "uninstall --purge --yes"
|
||||
if [ -z "$(files_in "$D")" ] && [ ! -e "$WORK/opt/my ide" ]; then ok "leaves nothing, and the prefix is gone"; else fail "leaves nothing, and the prefix is gone" "$(files_in "$D"; ls -la "$WORK/opt")"; fi
|
||||
|
||||
# --- 9. uninstalling ---------------------------------------------------------------------------
|
||||
echo "Uninstalling"
|
||||
attempt as "$A" "$A/.local/bin/llembas-ide" uninstall --yes
|
||||
out="$OUT"
|
||||
passes "uninstall --yes"
|
||||
left="$(files_in "$A")"
|
||||
if [ "$left" = "./.config/llembas-ide/lua/user/init.lua" ]; then ok "leaves nothing but the person's own file"; else fail "leaves nothing but the person's own file" "$left"; fi
|
||||
left="$(files_in "$A" | tr '\n' ' ')"
|
||||
if [ "$left" = "./.config/llembas-ide/lua/user/init.lua ./.config/llembas-ide/pack/user/start/mine/plugin/mine.lua " ]; then ok "leaves nothing but the person's own file and plugin"; else fail "leaves nothing but the person's own file and plugin" "$left"; fi
|
||||
check "which still has what the person wrote" grep -q 'llembas_ide_test_user = 42' "$A/.config/llembas-ide/lua/user/init.lua"
|
||||
attempt as "$B" "$B/.local/bin/llembas-ide" uninstall --purge --yes
|
||||
out="$OUT"
|
||||
|
||||
Reference in new issue
Block a user