Skip to content

Commit 1c8689b

Browse files
committed
Add tests for extra configure flags on the command-line
1 parent 6b6fa45 commit 1c8689b

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

test/build.bats

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,10 @@ OUT
261261
@test "readline is not linked from Homebrew when explicitly defined" {
262262
cached_tarball "ruby-2.0.0"
263263

264-
stub_repeated brew false
264+
readline_libdir="$TMP/homebrew-readline"
265+
mkdir -p "$readline_libdir"
266+
267+
stub_repeated brew "--prefix readline : echo '$readline_libdir'" ' : false'
265268
stub_make_install
266269

267270
export RUBY_CONFIGURE_OPTS='--with-readline-dir=/custom'
@@ -280,6 +283,29 @@ make install
280283
OUT
281284
}
282285

286+
@test "forward extra command-line arguments as configure flags" {
287+
cached_tarball "ruby-2.0.0"
288+
289+
stub_repeated brew false
290+
stub_make_install
291+
292+
cat > "$TMP/build-definition" <<DEF
293+
install_package "ruby-2.0.0" "http://ruby-lang.org/ruby/2.0/ruby-2.0.0.tar.gz"
294+
DEF
295+
296+
RUBY_CONFIGURE_OPTS='--with-readline-dir=/custom' run ruby-build "$TMP/build-definition" "$INSTALL_ROOT" -- cppflags="-DYJIT_FORCE_ENABLE -DRUBY_PATCHLEVEL_NAME=test" --with-openssl-dir=/path/to/openssl
297+
assert_success
298+
299+
unstub brew
300+
unstub make
301+
302+
assert_build_log <<OUT
303+
ruby-2.0.0: [--prefix=$INSTALL_ROOT,cppflags=-DYJIT_FORCE_ENABLE -DRUBY_PATCHLEVEL_NAME=test,--with-openssl-dir=/path/to/openssl,--with-readline-dir=/custom]
304+
make -j 2
305+
make install
306+
OUT
307+
}
308+
283309
@test "number of CPU cores defaults to 2" {
284310
cached_tarball "ruby-2.0.0"
285311

test/rbenv.bats

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,17 @@ stub_ruby_build() {
2626
unstub rbenv-rehash
2727
}
2828

29+
@test "install with flags" {
30+
stub_ruby_build 'echo "ruby-build $(inspect_args "$@")"'
31+
32+
run rbenv-install -kpv 2.1.2 -- --with-configure-opt="hello world"
33+
assert_success "ruby-build --keep --verbose --patch 2.1.2 ${RBENV_ROOT}/versions/2.1.2 -- \"--with-configure-opt=hello world\""
34+
35+
unstub ruby-build
36+
unstub rbenv-hooks
37+
unstub rbenv-rehash
38+
}
39+
2940
@test "suggest running rbenv global after install" {
3041
rm -rf "$RBENV_ROOT/version"
3142
stub_ruby_build 'echo ruby-build "$@"'

0 commit comments

Comments
 (0)