From a33c2f0bcef3a1b49e9a32adff57f3f6d8e4faef Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Tue, 25 Jun 2019 22:01:53 +0200 Subject: [PATCH] Port config tests to littlecheck This required a bit of thinking. What we do is we have one test that fakes $HOME, and then we do the various config tests there. The fake config we have is reused and we exercise all of the same codepaths. --- tests/checks/broken-config.fish | 20 ++++++++++++++++++++ tests/checks/broken-config/fish/config.fish | 4 ++++ 2 files changed, 24 insertions(+) create mode 100644 tests/checks/broken-config.fish create mode 100644 tests/checks/broken-config/fish/config.fish diff --git a/tests/checks/broken-config.fish b/tests/checks/broken-config.fish new file mode 100644 index 000000000..377b23929 --- /dev/null +++ b/tests/checks/broken-config.fish @@ -0,0 +1,20 @@ +#RUN: %fish -C 'set -g fish %fish' %s +begin + set -l dir $PWD/(dirname (status -f)) + set -gx XDG_CONFIG_HOME $dir/broken-config/ + set -gx HOME $dir/broken-config/ + $fish -l -c 'echo but still going' + # CHECK: broken + # CHECK: but still going + # CHECKERR: fish: Unknown command: syntax-error + # CHECKERR: ~//fish/config.fish (line {{\d+}}): + # CHECKERR: syntax-error + # CHECKERR: ^ + # CHECKERR: from sourcing file ~//fish/config.fish + # CHECKERR: called during startup + + $fish -c "echo normal command" -C "echo init" + # CHECK: broken + # CHECK: init + # CHECK: normal command +end diff --git a/tests/checks/broken-config/fish/config.fish b/tests/checks/broken-config/fish/config.fish new file mode 100644 index 000000000..2dc3d886d --- /dev/null +++ b/tests/checks/broken-config/fish/config.fish @@ -0,0 +1,4 @@ +echo broken +if status is-login + syntax-error +end