Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
ruby-build
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ruby-build
Commits
3b0714a7
Commit
3b0714a7
authored
Jan 21, 2016
by
Mislav Marohnić
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #890 from jasonkarns/test-assertions
Leverage assertion test helpers
parents
9fdc2fb1
84b49768
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
37 additions
and
30 deletions
+37
-30
test/build.bats
+1
-1
test/cache.bats
+9
-9
test/checksum.bats
+12
-11
test/definitions.bats
+1
-1
test/hooks.bats
+1
-1
test/mirror.bats
+6
-6
test/rbenv.bats
+1
-1
test/test_helper.bash
+6
-0
No files found.
test/build.bats
View file @
3b0714a7
...
@@ -546,7 +546,7 @@ install_package "jruby-9000.dev" "http://lafo.ssw.uni-linz.ac.at/jruby-9000+graa
...
@@ -546,7 +546,7 @@ install_package "jruby-9000.dev" "http://lafo.ssw.uni-linz.ac.at/jruby-9000+graa
DEF
DEF
assert_success
assert_success
assert [ !
-e "$INSTALL_ROOT/build.log" ]
refute [
-e "$INSTALL_ROOT/build.log" ]
}
}
@test "JRuby Java 7 missing" {
@test "JRuby Java 7 missing" {
...
...
test/cache.bats
View file @
3b0714a7
...
@@ -15,7 +15,7 @@ setup() {
...
@@ -15,7 +15,7 @@ setup() {
install_fixture definitions/without-checksum
install_fixture definitions/without-checksum
assert_success
assert_success
[ -e "${RUBY_BUILD_CACHE_PATH}/package-1.0.0.tar.gz" ]
assert
[ -e "${RUBY_BUILD_CACHE_PATH}/package-1.0.0.tar.gz" ]
unstub curl
unstub curl
}
}
...
@@ -29,7 +29,7 @@ setup() {
...
@@ -29,7 +29,7 @@ setup() {
install_fixture definitions/without-checksum
install_fixture definitions/without-checksum
assert_success
assert_success
[ -e "${RUBY_BUILD_CACHE_PATH}/package-1.0.0.tar.gz" ]
assert
[ -e "${RUBY_BUILD_CACHE_PATH}/package-1.0.0.tar.gz" ]
unstub curl
unstub curl
}
}
...
@@ -44,8 +44,8 @@ setup() {
...
@@ -44,8 +44,8 @@ setup() {
install_fixture definitions/with-checksum
install_fixture definitions/with-checksum
assert_success
assert_success
[ -x "${INSTALL_ROOT}/bin/package" ]
assert
[ -x "${INSTALL_ROOT}/bin/package" ]
[ -e "${RUBY_BUILD_CACHE_PATH}/package-1.0.0.tar.gz" ]
assert
[ -e "${RUBY_BUILD_CACHE_PATH}/package-1.0.0.tar.gz" ]
unstub curl
unstub curl
unstub shasum
unstub shasum
...
@@ -65,9 +65,9 @@ setup() {
...
@@ -65,9 +65,9 @@ setup() {
install_fixture definitions/with-checksum
install_fixture definitions/with-checksum
assert_success
assert_success
[ -x "${INSTALL_ROOT}/bin/package" ]
assert
[ -x "${INSTALL_ROOT}/bin/package" ]
[ -e "${RUBY_BUILD_CACHE_PATH}/package-1.0.0.tar.gz" ]
assert
[ -e "${RUBY_BUILD_CACHE_PATH}/package-1.0.0.tar.gz" ]
diff -q "${RUBY_BUILD_CACHE_PATH}/package-1.0.0.tar.gz" "${FIXTURE_ROOT}/package-1.0.0.tar.gz"
assert
diff -q "${RUBY_BUILD_CACHE_PATH}/package-1.0.0.tar.gz" "${FIXTURE_ROOT}/package-1.0.0.tar.gz"
unstub curl
unstub curl
unstub shasum
unstub shasum
...
@@ -82,8 +82,8 @@ setup() {
...
@@ -82,8 +82,8 @@ setup() {
install_fixture definitions/without-checksum
install_fixture definitions/without-checksum
assert_success
assert_success
[ -x "${INSTALL_ROOT}/bin/package" ]
assert
[ -x "${INSTALL_ROOT}/bin/package" ]
[ !
-d "$RUBY_BUILD_CACHE_PATH" ]
refute [
-d "$RUBY_BUILD_CACHE_PATH" ]
unstub curl
unstub curl
}
}
test/checksum.bats
View file @
3b0714a7
...
@@ -9,8 +9,9 @@ export RUBY_BUILD_CACHE_PATH=
...
@@ -9,8 +9,9 @@ export RUBY_BUILD_CACHE_PATH=
stub curl "-q -o * -*S* http://example.com/* : cp $FIXTURE_ROOT/\${5##*/} \$3"
stub curl "-q -o * -*S* http://example.com/* : cp $FIXTURE_ROOT/\${5##*/} \$3"
install_fixture definitions/without-checksum
install_fixture definitions/without-checksum
[ "$status" -eq 0 ]
[ -x "${INSTALL_ROOT}/bin/package" ]
assert_success
assert [ -x "${INSTALL_ROOT}/bin/package" ]
unstub curl
unstub curl
}
}
...
@@ -23,7 +24,7 @@ export RUBY_BUILD_CACHE_PATH=
...
@@ -23,7 +24,7 @@ export RUBY_BUILD_CACHE_PATH=
install_fixture definitions/with-checksum
install_fixture definitions/with-checksum
assert_success
assert_success
[ -x "${INSTALL_ROOT}/bin/package" ]
assert
[ -x "${INSTALL_ROOT}/bin/package" ]
unstub curl
unstub curl
unstub shasum
unstub shasum
...
@@ -37,7 +38,7 @@ export RUBY_BUILD_CACHE_PATH=
...
@@ -37,7 +38,7 @@ export RUBY_BUILD_CACHE_PATH=
install_fixture definitions/with-invalid-checksum
install_fixture definitions/with-invalid-checksum
assert_failure
assert_failure
[ !
-f "${INSTALL_ROOT}/bin/package" ]
refute [
-f "${INSTALL_ROOT}/bin/package" ]
unstub curl
unstub curl
unstub shasum
unstub shasum
...
@@ -51,7 +52,7 @@ export RUBY_BUILD_CACHE_PATH=
...
@@ -51,7 +52,7 @@ export RUBY_BUILD_CACHE_PATH=
install_fixture definitions/with-checksum
install_fixture definitions/with-checksum
assert_success
assert_success
[ -x "${INSTALL_ROOT}/bin/package" ]
assert
[ -x "${INSTALL_ROOT}/bin/package" ]
unstub curl
unstub curl
unstub shasum
unstub shasum
...
@@ -65,7 +66,7 @@ export RUBY_BUILD_CACHE_PATH=
...
@@ -65,7 +66,7 @@ export RUBY_BUILD_CACHE_PATH=
install_fixture definitions/with-md5-checksum
install_fixture definitions/with-md5-checksum
assert_success
assert_success
[ -x "${INSTALL_ROOT}/bin/package" ]
assert
[ -x "${INSTALL_ROOT}/bin/package" ]
unstub curl
unstub curl
unstub md5
unstub md5
...
@@ -79,7 +80,7 @@ export RUBY_BUILD_CACHE_PATH=
...
@@ -79,7 +80,7 @@ export RUBY_BUILD_CACHE_PATH=
install_fixture definitions/with-md5-checksum
install_fixture definitions/with-md5-checksum
assert_success
assert_success
[ -x "${INSTALL_ROOT}/bin/package" ]
assert
[ -x "${INSTALL_ROOT}/bin/package" ]
unstub curl
unstub curl
unstub md5
unstub md5
...
@@ -93,7 +94,7 @@ export RUBY_BUILD_CACHE_PATH=
...
@@ -93,7 +94,7 @@ export RUBY_BUILD_CACHE_PATH=
install_fixture definitions/with-checksum
install_fixture definitions/with-checksum
assert_failure
assert_failure
[ !
-f "${INSTALL_ROOT}/bin/package" ]
refute [
-f "${INSTALL_ROOT}/bin/package" ]
unstub curl
unstub curl
unstub shasum
unstub shasum
...
@@ -115,7 +116,7 @@ install_package "package-1.0.0" "http://example.com/packages/package-1.0.0.tar.g
...
@@ -115,7 +116,7 @@ install_package "package-1.0.0" "http://example.com/packages/package-1.0.0.tar.g
DEF
DEF
assert_success
assert_success
[ -x "${INSTALL_ROOT}/bin/package" ]
assert
[ -x "${INSTALL_ROOT}/bin/package" ]
unstub shasum
unstub shasum
}
}
...
@@ -137,7 +138,7 @@ install_package "package-1.0.0" "http://example.com/packages/package-1.0.0.tar.g
...
@@ -137,7 +138,7 @@ install_package "package-1.0.0" "http://example.com/packages/package-1.0.0.tar.g
DEF
DEF
assert_success
assert_success
[ -x "${INSTALL_ROOT}/bin/package" ]
assert
[ -x "${INSTALL_ROOT}/bin/package" ]
unstub shasum
unstub shasum
}
}
...
@@ -150,7 +151,7 @@ install_package "package-1.0.0" "http://example.com/packages/package-1.0.0.tar.g
...
@@ -150,7 +151,7 @@ install_package "package-1.0.0" "http://example.com/packages/package-1.0.0.tar.g
DEF
DEF
assert_failure
assert_failure
[ !
-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 "unexpected checksum length: 29 (checksum_of_unexpected_length)"
assert_output_contains "expected 0 (no checksum), 32 (MD5), or 64 (SHA2-256)"
assert_output_contains "expected 0 (no checksum), 32 (MD5), or 64 (SHA2-256)"
}
}
test/definitions.bats
View file @
3b0714a7
...
@@ -13,7 +13,7 @@ NUM_DEFINITIONS="$(ls "$BATS_TEST_DIRNAME"/../share/ruby-build | wc -l)"
...
@@ -13,7 +13,7 @@ NUM_DEFINITIONS="$(ls "$BATS_TEST_DIRNAME"/../share/ruby-build | wc -l)"
@test "custom RUBY_BUILD_ROOT: nonexistent" {
@test "custom RUBY_BUILD_ROOT: nonexistent" {
export RUBY_BUILD_ROOT="$TMP"
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
run ruby-build --definitions
assert_success ""
assert_success ""
}
}
...
...
test/hooks.bats
View file @
3b0714a7
...
@@ -52,5 +52,5 @@ rehashed
...
@@ -52,5 +52,5 @@ rehashed
after.
after.
OUT
OUT
assert [ !
-d "${RBENV_ROOT}/versions/2.0.0" ]
refute [
-d "${RBENV_ROOT}/versions/2.0.0" ]
}
}
test/mirror.bats
View file @
3b0714a7
...
@@ -14,7 +14,7 @@ export RUBY_BUILD_MIRROR_URL=http://mirror.example.com
...
@@ -14,7 +14,7 @@ export RUBY_BUILD_MIRROR_URL=http://mirror.example.com
echo "$output" >&2
echo "$output" >&2
assert_success
assert_success
[ -x "${INSTALL_ROOT}/bin/package" ]
assert
[ -x "${INSTALL_ROOT}/bin/package" ]
unstub curl
unstub curl
unstub shasum
unstub shasum
...
@@ -28,7 +28,7 @@ export RUBY_BUILD_MIRROR_URL=http://mirror.example.com
...
@@ -28,7 +28,7 @@ export RUBY_BUILD_MIRROR_URL=http://mirror.example.com
install_fixture definitions/with-checksum
install_fixture definitions/with-checksum
assert_success
assert_success
[ -x "${INSTALL_ROOT}/bin/package" ]
assert
[ -x "${INSTALL_ROOT}/bin/package" ]
unstub curl
unstub curl
unstub shasum
unstub shasum
...
@@ -46,7 +46,7 @@ export RUBY_BUILD_MIRROR_URL=http://mirror.example.com
...
@@ -46,7 +46,7 @@ export RUBY_BUILD_MIRROR_URL=http://mirror.example.com
install_fixture definitions/with-checksum
install_fixture definitions/with-checksum
assert_success
assert_success
[ -x "${INSTALL_ROOT}/bin/package" ]
assert
[ -x "${INSTALL_ROOT}/bin/package" ]
unstub curl
unstub curl
unstub shasum
unstub shasum
...
@@ -64,7 +64,7 @@ export RUBY_BUILD_MIRROR_URL=http://mirror.example.com
...
@@ -64,7 +64,7 @@ export RUBY_BUILD_MIRROR_URL=http://mirror.example.com
install_fixture definitions/with-checksum
install_fixture definitions/with-checksum
assert_success
assert_success
[ -x "${INSTALL_ROOT}/bin/package" ]
assert
[ -x "${INSTALL_ROOT}/bin/package" ]
unstub curl
unstub curl
unstub shasum
unstub shasum
...
@@ -84,7 +84,7 @@ export RUBY_BUILD_MIRROR_URL=http://mirror.example.com
...
@@ -84,7 +84,7 @@ export RUBY_BUILD_MIRROR_URL=http://mirror.example.com
echo "$output" >&2
echo "$output" >&2
assert_success
assert_success
[ -x "${INSTALL_ROOT}/bin/package" ]
assert
[ -x "${INSTALL_ROOT}/bin/package" ]
unstub curl
unstub curl
unstub shasum
unstub shasum
...
@@ -102,7 +102,7 @@ export RUBY_BUILD_MIRROR_URL=http://mirror.example.com
...
@@ -102,7 +102,7 @@ export RUBY_BUILD_MIRROR_URL=http://mirror.example.com
install_fixture definitions/with-checksum
install_fixture definitions/with-checksum
assert_success
assert_success
[ -x "${INSTALL_ROOT}/bin/package" ]
assert
[ -x "${INSTALL_ROOT}/bin/package" ]
unstub curl
unstub curl
unstub shasum
unstub shasum
...
...
test/rbenv.bats
View file @
3b0714a7
...
@@ -97,7 +97,7 @@ OUT
...
@@ -97,7 +97,7 @@ OUT
}
}
@test "no build definitions from plugins" {
@test "no build definitions from plugins" {
assert [ !
-e "${RBENV_ROOT}/plugins" ]
refute [
-e "${RBENV_ROOT}/plugins" ]
stub_ruby_build 'echo $RUBY_BUILD_DEFINITIONS'
stub_ruby_build 'echo $RUBY_BUILD_DEFINITIONS'
run rbenv-install 2.1.2
run rbenv-install 2.1.2
...
...
test/test_helper.bash
View file @
3b0714a7
...
@@ -71,6 +71,12 @@ assert() {
...
@@ -71,6 +71,12 @@ assert() {
fi
fi
}
}
refute
()
{
if
"
$@
"
;
then
flunk
"expected to fail:
$@
"
fi
}
flunk
()
{
flunk
()
{
{
if
[
"$#"
-eq
0
]
;
then
cat
-
{
if
[
"$#"
-eq
0
]
;
then
cat
-
else
echo
"
$@
"
else
echo
"
$@
"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment