From 42acff9ae1965cb357c5a04aa129b00a05b1ff18 Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Mon, 28 Dec 2020 22:38:49 +0200 Subject: [PATCH] test: alias-completion: Improve rm test by using function and not alias Works better, and more sane --- test/plugins/alias-completion.plugin.bats | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/test/plugins/alias-completion.plugin.bats b/test/plugins/alias-completion.plugin.bats index 1a78e462..e2c15da6 100644 --- a/test/plugins/alias-completion.plugin.bats +++ b/test/plugins/alias-completion.plugin.bats @@ -9,6 +9,13 @@ cite _about _param _example _group _author _version load ../../completion/available/capistrano.completion +teardown() { + # Mostly for the hidden behind function test + unset -f rm + + rm -f test.file +} + @test "alias-completion: See that aliases with double quotes and brackets do not break the plugin" { alias gtest="git log --graph --pretty=format:'%C(bold)%h%Creset%C(magenta)%d%Creset %s %C(yellow)<%an> %C(cyan)(%cr)%Creset' --abbrev-commit --date=relative" load ../../plugins/available/alias-completion.plugin @@ -23,9 +30,13 @@ load ../../completion/available/capistrano.completion assert_success } -@test "alias-completion: See that having aliased rm command does not output unnecessary output" { - alias rm='rm -v' +@test "alias-completion: See that hidden behind function rm command does not change behavior" { + rm() { + touch test.file; + command rm "$@"; + } load ../../plugins/available/alias-completion.plugin - refute_output + run stat test.file + assert_failure }