aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_rubyoptions.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_rubyoptions.rb')
-rw-r--r--test/ruby/test_rubyoptions.rb14
1 files changed, 8 insertions, 6 deletions
diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb
index ba23604bb6..1705839bd7 100644
--- a/test/ruby/test_rubyoptions.rb
+++ b/test/ruby/test_rubyoptions.rb
@@ -84,18 +84,20 @@ class TestRubyOptions < Test::Unit::TestCase
"", %w(true), [])
end
- private def version_match
+ q = Regexp.method(:quote)
+ VERSION_PATTERN =
case RUBY_ENGINE
when 'jruby'
- /^jruby #{RUBY_ENGINE_VERSION} \(#{RUBY_VERSION}\).*? \[#{RbConfig::CONFIG["host_os"]}-#{RbConfig::CONFIG["host_cpu"]}\]$/
+ /^jruby #{q[RUBY_ENGINE_VERSION]} \(#{q[RUBY_VERSION]}\).*? \[#{
+ q[RbConfig::CONFIG["host_os"]]}-#{q[RbConfig::CONFIG["host_cpu"]]}\]$/
else
- /^ruby #{RUBY_VERSION}(?:[p ]|dev|rc).*? \[#{RUBY_PLATFORM}\]$/
+ /^ruby #{q[RUBY_VERSION]}(?:[p ]|dev|rc).*? \[#{q[RUBY_PLATFORM]}\]$/
end
- end
+ private_constant :VERSION_PATTERN
def test_verbose
assert_in_out_err(["-vve", ""]) do |r, e|
- assert_match(version_match, r[0])
+ assert_match(VERSION_PATTERN, r[0])
assert_equal(RUBY_DESCRIPTION, r[0])
assert_equal([], e)
end
@@ -151,7 +153,7 @@ class TestRubyOptions < Test::Unit::TestCase
def test_version
assert_in_out_err(%w(--version)) do |r, e|
- assert_match(version_match, r[0])
+ assert_match(VERSION_PATTERN, r[0])
assert_equal(RUBY_DESCRIPTION, r[0])
assert_equal([], e)
end