From 5657f093e7b9ce8211a674ef5973f144572e457c Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Thu, 29 May 2025 14:20:11 +0200 Subject: [PATCH] Test case for autoload + erase + autoload Commit 5918bca1eba (Make "complete -e" prevent completion autoloading, 2024-08-24) has a weird "!removed" check; it was added because "complete -e" only needs to create the tombstone if we removed nothing. Otherwise the autoloader will usually take care of not loading the removed completions again. We should probably get rid of "!removed".. for now add a test to demonstrate this behavior. --- .../checks/completion-autoload-tombstone.fish | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/tests/checks/completion-autoload-tombstone.fish b/tests/checks/completion-autoload-tombstone.fish index 32ff47daa..1faef8d7c 100644 --- a/tests/checks/completion-autoload-tombstone.fish +++ b/tests/checks/completion-autoload-tombstone.fish @@ -1,6 +1,17 @@ -#RUN: %fish %s +#RUN: fish=%fish %fish %s -complete -e cat - -complete -C"cat -" | wc -l +$fish -c ' + complete -e cat + complete -C"cat -" | wc -l +' +# CHECK: 0 + +# Note: this is *not* handled by the tombstone logic. +# We don't reload cat.fish because it is cached by the autoloader, +# and we don't invalidate the cache. +$fish -c ' + complete -C"cat -" >/dev/null + complete -e cat + complete -C"cat -" | wc -l +' # CHECK: 0