diff --git a/tests/functional.fish b/tests/functional.fish index e4d1651..b3e6df7 100644 --- a/tests/functional.fish +++ b/tests/functional.fish @@ -97,6 +97,32 @@ function test_vault_dir_honors_override test "$got" = /tmp/vault-override-check end +function test_conf_d_is_lazy_in_scripts + # A non-interactive shell must not load interactive-only conf.d work. + # The child inherits XDG_CONFIG_HOME from the sandboxed session, so it + # loads the same config under test. Each exit code names one regression. + # + # Assertion 5 (tailscale) is vacuously true where tailscale is not + # installed: conf.d/tailscale.fish returned early on `type -q tailscale` + # before this change, and completions/tailscale.fish does the same, so the + # function is absent either way. The test still cannot fail wrongly there + # -- it just stops proving anything about that one file. A positive + # "completions still work" check would need the binary present and would + # make the suite machine-dependent, so it stays out. + fish -c ' + abbr -q n; and exit 1 + functions -q fish_user_key_bindings; and exit 2 + functions -q expand_bang_all; and exit 3 + functions -q __fish_config_logging_changed; and exit 4 + functions -q __tailscale_perform_completion; and exit 5 + exit 0' +end + +function test_key_bindings_defined + # Positive counterpart to assertion 2 above: the guard must not over-fire. + functions -q fish_user_key_bindings +end + function functional_test_main set -l names (functions -a | string match 'test_*' | sort) set -l failed 0