From d8934360d2453a403b5433e71d09188e4ed23b57 Mon Sep 17 00:00:00 2001 From: Eric Bavier Date: Fri, 25 Sep 2020 11:00:11 -0500 Subject: tests: Simplify shell exit status negation; * tests/guix-archive.sh, tests/guix-build-branch.sh, tests/guix-build.sh, tests/guix-daemon.sh, tests/guix-download.sh, tests/guix-environment.sh, tests/guix-gc.sh, tests/guix-git-authenticate.sh, tests/guix-graph.sh, tests/guix-hash.sh, tests/guix-lint.sh, tests/guix-pack-relocatable.sh, tests/guix-pack.sh, tests/guix-package-aliases.sh, tests/guix-package-net.sh, tests/guix-package.sh: Use the shell '!' keyword to negate command exit status in place of 'if ...; then false; else true; fi' --- tests/guix-hash.sh | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'tests/guix-hash.sh') diff --git a/tests/guix-hash.sh b/tests/guix-hash.sh index 3538b9aeda..346355539f 100644 --- a/tests/guix-hash.sh +++ b/tests/guix-hash.sh @@ -34,8 +34,7 @@ test `guix hash -f base32 /dev/null` = 4oymiquy7qobjgx36tejs35zeqt24qpemsnzgtfes test `guix hash -H sha512 -f hex /dev/null` = cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e test `guix hash -H sha1 -f base64 /dev/null` = "2jmj7l5rSw0yVb/vlWAYkK/YBwk=" -if guix hash -H abcd1234 /dev/null; -then false; else true; fi +! guix hash -H abcd1234 /dev/null mkdir "$tmpdir" echo -n executable > "$tmpdir/exe" @@ -46,13 +45,11 @@ mkdir "$tmpdir/subdir" test `guix hash -r "$tmpdir"` = 10k1lw41wyrjf9mxydi0is5nkpynlsvgslinics4ppir13g7d74p # Without '-r', this should fail. -if guix hash "$tmpdir" -then false; else true; fi +! guix hash "$tmpdir" # This should fail because /dev/null is a character device, which # the archive format doesn't support. -if guix hash -r /dev/null -then false; else true; fi +! guix hash -r /dev/null # Adding a .git directory mkdir "$tmpdir/.git" @@ -65,6 +62,5 @@ test `guix hash -r $tmpdir` = 0a50z04zyzf7pidwxv0nwbj82pgzbrhdy9562kncnvkcfvb48m test `guix hash -r $tmpdir -x` = 10k1lw41wyrjf9mxydi0is5nkpynlsvgslinics4ppir13g7d74p # Without '-r', this should fail. -if guix hash "$tmpdir" -then false; else true; fi +! guix hash "$tmpdir" -- cgit 1.4.1