1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Expect multi-line -v output for -DRUBY_DEVEL in tests

On -DRUBY_DEVEL builds, `ruby -v` can print extra info about the last
commit on a separate line, breaking some tests that expect a single
line. Assert only the first line instead.
This commit is contained in:
Alan Wu 2021-10-25 20:28:21 -04:00
parent 0d9913e52f
commit 6875d6d1fa
Notes: git 2021-10-28 02:00:39 +09:00

View file

@ -23,7 +23,7 @@ class TestYJIT < Test::Unit::TestCase
%w(--version --disable=yjit --enable=yjit),
].each do |version_args|
assert_in_out_err(version_args) do |stdout, stderr|
assert_equal([RUBY_DESCRIPTION], stdout)
assert_equal(RUBY_DESCRIPTION, stdout.first)
assert_equal([], stderr)
end
end
@ -39,7 +39,10 @@ class TestYJIT < Test::Unit::TestCase
def test_enable_from_env_var
yjit_child_env = {'RUBY_YJIT_ENABLE' => '1'}
assert_in_out_err([yjit_child_env, '--version'], '', [RUBY_DESCRIPTION])
assert_in_out_err([yjit_child_env, '--version'], '') do |stdout, stderr|
assert_equal(RUBY_DESCRIPTION, stdout.first)
assert_equal([], stderr)
end
assert_in_out_err([yjit_child_env, '-e puts RUBY_DESCRIPTION'], '', [RUBY_DESCRIPTION])
assert_in_out_err([yjit_child_env, '-e p YJIT.enabled?'], '', ['true'])
end