[前][次][番号順一覧][スレッド一覧]

ruby-changes:42030

From: headius <ko1@a...>
Date: Tue, 15 Mar 2016 01:24:09 +0900 (JST)
Subject: [ruby-changes:42030] headius:r54103 (trunk): * test/ruby/test_rubyoptions.rb: make version matching support

headius	2016-03-15 01:24:04 +0900 (Tue, 15 Mar 2016)

  New Revision: 54103

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54103

  Log:
    * test/ruby/test_rubyoptions.rb: make version matching support
      JRuby's version output.

  Modified files:
    trunk/ChangeLog
    trunk/test/ruby/test_rubyoptions.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 54102)
+++ ChangeLog	(revision 54103)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Mar 15 01:22:27 2016  Charles Oliver Nutter  <headius@h...>
+
+	* test/ruby/test_rubyoptions.rb: make version matching support
+	  JRuby's version output.
+
 Mon Mar 14 19:05:39 2016  NARUSE, Yui  <naruse@r...>
 
 	* bignum.c (big2str_2bdigits): reduce div instruction.
Index: test/ruby/test_rubyoptions.rb
===================================================================
--- test/ruby/test_rubyoptions.rb	(revision 54102)
+++ test/ruby/test_rubyoptions.rb	(revision 54103)
@@ -84,9 +84,18 @@ class TestRubyOptions < Test::Unit::Test https://github.com/ruby/ruby/blob/trunk/test/ruby/test_rubyoptions.rb#L84
                       "", %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::Test https://github.com/ruby/ruby/blob/trunk/test/ruby/test_rubyoptions.rb#L149
 
   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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]