Add refute test helper

This commit is contained in:
Jason Karns 2015-10-29 10:40:32 -04:00
parent 8f86b59a34
commit 84b49768b9
7 changed files with 14 additions and 8 deletions

View file

@ -546,7 +546,7 @@ install_package "jruby-9000.dev" "http://lafo.ssw.uni-linz.ac.at/jruby-9000+graa
DEF
assert_success
assert [ ! -e "$INSTALL_ROOT/build.log" ]
refute [ -e "$INSTALL_ROOT/build.log" ]
}
@test "JRuby Java 7 missing" {

View file

@ -83,7 +83,7 @@ setup() {
assert_success
assert [ -x "${INSTALL_ROOT}/bin/package" ]
assert [ ! -d "$RUBY_BUILD_CACHE_PATH" ]
refute [ -d "$RUBY_BUILD_CACHE_PATH" ]
unstub curl
}

View file

@ -38,7 +38,7 @@ export RUBY_BUILD_CACHE_PATH=
install_fixture definitions/with-invalid-checksum
assert_failure
assert [ ! -f "${INSTALL_ROOT}/bin/package" ]
refute [ -f "${INSTALL_ROOT}/bin/package" ]
unstub curl
unstub shasum
@ -94,7 +94,7 @@ export RUBY_BUILD_CACHE_PATH=
install_fixture definitions/with-checksum
assert_failure
assert [ ! -f "${INSTALL_ROOT}/bin/package" ]
refute [ -f "${INSTALL_ROOT}/bin/package" ]
unstub curl
unstub shasum
@ -151,7 +151,7 @@ install_package "package-1.0.0" "http://example.com/packages/package-1.0.0.tar.g
DEF
assert_failure
assert [ ! -f "${INSTALL_ROOT}/bin/package" ]
refute [ -f "${INSTALL_ROOT}/bin/package" ]
assert_output_contains "unexpected checksum length: 29 (checksum_of_unexpected_length)"
assert_output_contains "expected 0 (no checksum), 32 (MD5), or 64 (SHA2-256)"
}

View file

@ -13,7 +13,7 @@ NUM_DEFINITIONS="$(ls "$BATS_TEST_DIRNAME"/../share/ruby-build | wc -l)"
@test "custom RUBY_BUILD_ROOT: nonexistent" {
export RUBY_BUILD_ROOT="$TMP"
assert [ ! -e "${RUBY_BUILD_ROOT}/share/ruby-build" ]
refute [ -e "${RUBY_BUILD_ROOT}/share/ruby-build" ]
run ruby-build --definitions
assert_success ""
}

View file

@ -52,5 +52,5 @@ rehashed
after.
OUT
assert [ ! -d "${RBENV_ROOT}/versions/2.0.0" ]
refute [ -d "${RBENV_ROOT}/versions/2.0.0" ]
}

View file

@ -97,7 +97,7 @@ OUT
}
@test "no build definitions from plugins" {
assert [ ! -e "${RBENV_ROOT}/plugins" ]
refute [ -e "${RBENV_ROOT}/plugins" ]
stub_ruby_build 'echo $RUBY_BUILD_DEFINITIONS'
run rbenv-install 2.1.2

View file

@ -71,6 +71,12 @@ assert() {
fi
}
refute() {
if "$@"; then
flunk "expected to fail: $@"
fi
}
flunk() {
{ if [ "$#" -eq 0 ]; then cat -
else echo "$@"