aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_rubyoptions.rb
diff options
context:
space:
mode:
authorheadius <headius@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-14 16:24:04 +0000
committerheadius <headius@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-14 16:24:04 +0000
commita4e97af645df5b19c335e4e131b7f5f9085485df (patch)
treefa054216d681ba915f80657db3391a1e98063d58 /test/ruby/test_rubyoptions.rb
parent3d5a3a236d99e7512955947be832b343b18b024c (diff)
downloadruby-a4e97af645df5b19c335e4e131b7f5f9085485df.tar.gz
* test/ruby/test_rubyoptions.rb: make version matching support
JRuby's version output. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54103 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_rubyoptions.rb')
-rw-r--r--test/ruby/test_rubyoptions.rb13
1 files changed, 11 insertions, 2 deletions
diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb
index ea361bcf37..765af9d807 100644
--- a/test/ruby/test_rubyoptions.rb
+++ b/test/ruby/test_rubyoptions.rb
@@ -84,9 +84,18 @@ class TestRubyOptions < Test::Unit::TestCase
"", %w(true), [])
end
+ private def version_match
+ case RUBY_ENGINE
+ when 'jruby'
+ /^jruby #{RUBY_ENGINE_VERSION} \(#{RUBY_VERSION}\).*? \[#{RbConfig::CONFIG["host_os"]}-#{RbConfig::CONFIG["host_cpu"]}\]$/
+ else
+ /^ruby #{RUBY_VERSION}(?:[p ]|dev|rc).*? \[#{RUBY_PLATFORM}\]$/
+ end
+ end
+
def test_verbose
assert_in_out_err(["-vve", ""]) do |r, e|
- assert_match(/^ruby #{RUBY_VERSION}(?:[p ]|dev|rc).*? \[#{RUBY_PLATFORM}\]$/, r[0])
+ assert_match(version_match, r[0])
assert_equal(RUBY_DESCRIPTION, r[0])
assert_equal([], e)
end
@@ -140,7 +149,7 @@ class TestRubyOptions < Test::Unit::TestCase
def test_version
assert_in_out_err(%w(--version)) do |r, e|
- assert_match(/^ruby #{RUBY_VERSION}(?:[p ]|dev|rc).*? \[#{RUBY_PLATFORM}\]$/, r[0])
+ assert_match(version_match, r[0])
assert_equal(RUBY_DESCRIPTION, r[0])
assert_equal([], e)
end