diff options
-rw-r--r-- | test/aur-test.sh | 2 | ||||
-rw-r--r-- | test/is_built-test.sh | 2 | ||||
-rw-r--r-- | test/lib-blacklist-test.sh | 10 | ||||
-rw-r--r-- | test/lib-messages-test.sh | 4 | ||||
-rw-r--r-- | test/librechroot-test.sh | 14 | ||||
-rw-r--r-- | test/librelib-test.sh | 4 | ||||
-rw-r--r-- | test/libremakepkg-test.sh | 12 | ||||
-rw-r--r-- | test/librestage-test.sh | 4 | ||||
-rw-r--r-- | test/pkgbuild-check-nonfree-test.sh | 10 | ||||
-rw-r--r-- | test/test-common.sh | 6 |
10 files changed, 37 insertions, 31 deletions
diff --git a/test/aur-test.sh b/test/aur-test.sh index 8bcb5ef..5de590b 100644 --- a/test/aur-test.sh +++ b/test/aur-test.sh @@ -24,7 +24,7 @@ it_fails_with_0_args() { [[ $stat != 0 ]] empty $tmpdir/stdout - ! empty $tmpdir/stderr + not empty $tmpdir/stderr } # TODO: Actually test diff --git a/test/is_built-test.sh b/test/is_built-test.sh index af754dc..f7f6c65 100644 --- a/test/is_built-test.sh +++ b/test/is_built-test.sh @@ -24,7 +24,7 @@ it_fails_with_0_args() { [[ $stat -gt 1 ]] empty $tmpdir/stdout - ! empty $tmpdir/stderr + not empty $tmpdir/stderr } it_succeeds_with_1_arg() { diff --git a/test/lib-blacklist-test.sh b/test/lib-blacklist-test.sh index 640ed77..9dfd5da 100644 --- a/test/lib-blacklist-test.sh +++ b/test/lib-blacklist-test.sh @@ -53,7 +53,7 @@ it_fails_update_with_no_blacklist_or_network() { [[ $stat != 0 ]] empty $tmpdir/stdout - ! empty $tmpdir/stderr + not empty $tmpdir/stderr } it_fails_cat_with_no_blacklist_or_network() { @@ -64,7 +64,7 @@ it_fails_cat_with_no_blacklist_or_network() { [[ $stat != 0 ]] empty $tmpdir/stdout - ! empty $tmpdir/stderr + not empty $tmpdir/stderr } it_fails_update_when_BLACKLIST_is_unset() { @@ -75,7 +75,7 @@ it_fails_update_when_BLACKLIST_is_unset() { [[ $stat != 0 ]] empty $tmpdir/stdout - ! empty $tmpdir/stderr + not empty $tmpdir/stderr } it_fails_cat_when_syntax_error_in_conf() { @@ -87,7 +87,7 @@ it_fails_cat_when_syntax_error_in_conf() { [[ $stat != 0 ]] empty $tmpdir/stdout - ! empty $tmpdir/stderr + not empty $tmpdir/stderr } it_downloads_the_blacklist_as_needed() { @@ -97,7 +97,7 @@ it_downloads_the_blacklist_as_needed() { libreblacklist cat >$tmpdir/stdout 2>$tmpdir/stderr - ! empty $tmpdir/stdout + not empty $tmpdir/stdout } it_downloads_the_blacklist_repeatedly() { diff --git a/test/lib-messages-test.sh b/test/lib-messages-test.sh index fffff36..3fcac63 100644 --- a/test/lib-messages-test.sh +++ b/test/lib-messages-test.sh @@ -31,14 +31,14 @@ it_works_with_no_color_and_set_euE() ( ) >$tmpdir/stdout 2>$tmpdir/stderr empty $tmpdir/stdout - ! empty $tmpdir/stderr + not empty $tmpdir/stderr ) it_can_be_called_without_including() { libremessages msg Foo >$tmpdir/stdout 2>$tmpdir/stderr empty $tmpdir/stdout - ! empty $tmpdir/stderr + not empty $tmpdir/stderr } it_fails_with_msg_and_no_args() { diff --git a/test/librechroot-test.sh b/test/librechroot-test.sh index 3896005..c22ac58 100644 --- a/test/librechroot-test.sh +++ b/test/librechroot-test.sh @@ -54,22 +54,22 @@ it_disables_networking_when_requested() { require network sudo || return 0 libremessages msg 'Creating a chroot, may take a few minutes' &>/dev/tty - testsudo librechroot -l "$roundup_test_name" run curl https://repo.parabolagnulinux.org/ >/dev/null - ! testsudo librechroot -l "$roundup_test_name" -N run curl https://repo.parabolagnulinux.org/ >/dev/null + testsudo librechroot -l "$roundup_test_name" run curl https://repo.parabolagnulinux.org/ >/dev/null + not testsudo librechroot -l "$roundup_test_name" -N run curl https://repo.parabolagnulinux.org/ >/dev/null } it_handles_CHROOTEXTRAPKG_correctly() { requuire network sudo || return 0 libremessages msg 'Creating a chroot, may take a few minutes' &>/dev/tty - ! testsudo librechroot -l "$roundup_test_name" run lsof + not testsudo librechroot -l "$roundup_test_name" run lsof echo "CHROOTEXTRAPKG=(lsof)" >> "$XDG_CONFIG_HOME"/libretools/chroot.conf testsudo librechroot -l "$roundup_test_name" install-name lsof testsudo librechroot -l "$roundup_test_name" clean-pkgs testsudo librechroot -l "$roundup_test_name" run lsof echo "CHROOTEXTRAPKG=()" >> "$XDG_CONFIG_HOME"/libretools/chroot.conf testsudo librechroot -l "$roundup_test_name" clean-pkgs - ! testsudo librechroot -l "$roundup_test_name" run lsof + not testsudo librechroot -l "$roundup_test_name" run lsof } it_displays_help_as_normal_user() { @@ -85,7 +85,7 @@ it_otherwise_fails_as_normal_user() { [[ $stat != 0 ]] empty $tmpdir/stdout - ! empty $tmpdir/stderr + not empty $tmpdir/stderr } it_displays_help_and_fails_with_0_args() { @@ -103,7 +103,7 @@ it_fails_for_unknown_commands() { [[ $stat != 0 ]] empty $tmpdir/stdout - ! empty $tmpdir/stderr + not empty $tmpdir/stderr } # requires sudo so we know it's not failing because it needs root @@ -113,5 +113,5 @@ it_fails_for_unknown_flags() { [[ $stat != 0 ]] empty $tmpdir/stdout - ! empty $tmpdir/stderr + not empty $tmpdir/stderr } diff --git a/test/librelib-test.sh b/test/librelib-test.sh index 23c38dc..a74ce0a 100644 --- a/test/librelib-test.sh +++ b/test/librelib-test.sh @@ -26,7 +26,7 @@ it_fails_with_2_args() { librelib a b >$tmpdir/stdout 2>$tmpdir/stderr || ret=$? empty $tmpdir/stdout - ! empty $tmpdir/stderr + not empty $tmpdir/stderr [[ $ret != 0 ]] } @@ -68,6 +68,6 @@ it_fails_to_find_phony() { librelib phony >$tmpdir/stdout 2>$tmpdir/stderr || ret=$? empty $tmpdir/stdout - ! empty $tmpdir/stderr + not empty $tmpdir/stderr [[ $ret != 0 ]] } diff --git a/test/libremakepkg-test.sh b/test/libremakepkg-test.sh index 06cf695..811c8ed 100644 --- a/test/libremakepkg-test.sh +++ b/test/libremakepkg-test.sh @@ -40,8 +40,8 @@ it_disables_networking_during_build() { cd "$tmpdir" libremessages msg 'Creating a chroot, may take a few minutes' &>/dev/tty - ! testsudo libremakepkg -l "$roundup_test_name" - ! [[ -f $(echo libretools-netbuild-1.0-1-any.pkg.tar.?z) ]] + not testsudo libremakepkg -l "$roundup_test_name" + not [[ -f $(echo libretools-netbuild-1.0-1-any.pkg.tar.?z) ]] testsudo libremakepkg -l "$roundup_test_name" -N [[ -f $(echo libretools-netbuild-1.0-1-any.pkg.tar.?z) ]] } @@ -52,8 +52,8 @@ it_disables_networking_during_package() { cd "$tmpdir" libremessages msg 'Creating a chroot, may take a few minutes' &>/dev/tty - ! testsudo libremakepkg -l "$roundup_test_name" - ! [[ -f $(echo libretools-netpackage-1.0-1-any.pkg.tar.?z) ]] + not testsudo libremakepkg -l "$roundup_test_name" + not [[ -f $(echo libretools-netpackage-1.0-1-any.pkg.tar.?z) ]] testsudo libremakepkg -l "$roundup_test_name" -N [[ -f $(echo libretools-netpackage-1.0-1-any.pkg.tar.?z) ]] } @@ -83,7 +83,7 @@ it_cleans_the_chroot_before_building() { testsudo librechroot -l "$roundup_test_name" run libretools-testpkg1 'first time, pass' cd "$tmpdir/3" testsudo libremakepkg -l "$roundup_test_name" &> "$tmpdir/out" || { r=$?; tail "$tmpdir/out"|cat -v; return $r; } - ! testsudo librechroot -l "$roundup_test_name" run libretools-testpkg1 'second time, fail' + not testsudo librechroot -l "$roundup_test_name" run libretools-testpkg1 'second time, fail' } it_handles_PKGDEST_not_existing() { @@ -114,5 +114,5 @@ it_otherwise_fails_as_normal_user() { [[ $stat != 0 ]] empty $tmpdir/stdout - ! empty $tmpdir/stderr + not empty $tmpdir/stderr } diff --git a/test/librestage-test.sh b/test/librestage-test.sh index 6728143..460eb58 100644 --- a/test/librestage-test.sh +++ b/test/librestage-test.sh @@ -34,7 +34,7 @@ it_fails_with_0_args() { [[ $stat != 0 ]] empty "$tmpdir/stdout" - ! empty "$tmpdir/stderr" + not empty "$tmpdir/stderr" } it_fails_with_invalid_args() { @@ -42,7 +42,7 @@ it_fails_with_invalid_args() { [[ $stat != 0 ]] empty "$tmpdir/stdout" - ! empty "$tmpdir/stderr" + not empty "$tmpdir/stderr" } # This was an actual bug I hit with md/emacs-mdmua a long time ago; solution was diff --git a/test/pkgbuild-check-nonfree-test.sh b/test/pkgbuild-check-nonfree-test.sh index 6463d64..2af2669 100644 --- a/test/pkgbuild-check-nonfree-test.sh +++ b/test/pkgbuild-check-nonfree-test.sh @@ -39,7 +39,7 @@ it_succeeds_for_free_depends() { $pcn $pcn.d/PKGBUILD.free >$tmpdir/stdout 2>$tmpdir/stderr || stat=$? empty $tmpdir/stdout - ! empty $tmpdir/stderr + not empty $tmpdir/stderr [[ $stat == 0 ]] } @@ -47,7 +47,7 @@ it_succeeds_for_nonfree_depend_with_replacement() { $pcn $pcn.d/PKGBUILD.nonfree-replacement >$tmpdir/stdout 2>$tmpdir/stderr || stat=$? empty $tmpdir/stdout - ! empty $tmpdir/stderr + not empty $tmpdir/stderr [[ $stat == 0 ]] } @@ -55,14 +55,14 @@ it_fails_for_nonfree_depend() { $pcn $pcn.d/PKGBUILD.nonfree >$tmpdir/stdout 2>$tmpdir/stderr || stat=$? [[ $stat != 0 ]] empty $tmpdir/stdout - ! empty $tmpdir/stderr + not empty $tmpdir/stderr local pcn_stat=$stat $psn $pcn_stat >$tmpdir/stdout 2>$tmpdir/stderr || stat=$? [[ $stat != 0 ]] empty $tmpdir/stdout - ! empty $tmpdir/stderr + not empty $tmpdir/stderr } it_fails_when_there_is_no_blacklist() { @@ -73,6 +73,6 @@ it_fails_when_there_is_no_blacklist() { $pcn $pcn.d/PKGBUILD.free >$tmpdir/stdout 2>$tmpdir/stderr || stat=$? empty $tmpdir/stdout - ! empty $tmpdir/stderr + not empty $tmpdir/stderr [[ $stat != 0 ]] && [[ $stat != 15 ]] } diff --git a/test/test-common.sh b/test/test-common.sh index 3df7107..c525dd8 100644 --- a/test/test-common.sh +++ b/test/test-common.sh @@ -70,3 +70,9 @@ empty() ( set +x [[ $(stat -c %s "$1") -eq 0 ]] ) + +# Just using '!' doesn't trip `set -e` +not() ( + set +x + ! eval "$@" +) |