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

ruby-changes:27441

From: nobu <ko1@a...>
Date: Mon, 25 Feb 2013 17:10:49 +0900 (JST)
Subject: [ruby-changes:27441] nobu:r39493 (trunk): test_string.rb: ENUMERATORS_WANTARRAY

nobu	2013-02-25 17:10:40 +0900 (Mon, 25 Feb 2013)

  New Revision: 39493

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=39493

  Log:
    test_string.rb: ENUMERATORS_WANTARRAY
    
    * test/ruby/test_string.rb (TestString::ENUMERATOR_WANTARRAY): name
      test branching codition.

  Modified files:
    trunk/test/ruby/test_string.rb

Index: test/ruby/test_string.rb
===================================================================
--- test/ruby/test_string.rb	(revision 39492)
+++ test/ruby/test_string.rb	(revision 39493)
@@ -6,6 +6,7 @@ def pre_1_7_1 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_string.rb#L6
 end
 
 class TestString < Test::Unit::TestCase
+  ENUMERATOR_WANTARRAY = RUBY_VERSION >= "2.1.0"
 
   def initialize(*args)
     @cls = String
@@ -642,7 +643,7 @@ class TestString < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_string.rb#L643
     s = S("ABC")
     assert_equal [65, 66, 67], s.bytes
 
-    if RUBY_VERSION >= "2.1.0"
+    if ENUMERATOR_WANTARRAY
       assert_warn(/block not used/) {
         assert_equal [65, 66, 67], s.bytes {}
       }
@@ -679,7 +680,7 @@ class TestString < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_string.rb#L680
     s = S("\u3042\u3044\u3046")
     assert_equal [0x3042, 0x3044, 0x3046], s.codepoints
 
-    if RUBY_VERSION >= "2.1.0"
+    if ENUMERATOR_WANTARRAY
       assert_warn(/block not used/) {
         assert_equal [0x3042, 0x3044, 0x3046], s.codepoints {}
       }
@@ -710,7 +711,7 @@ class TestString < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_string.rb#L711
     s = S("ABC")
     assert_equal ["A", "B", "C"], s.chars
 
-    if RUBY_VERSION >= "2.1.0"
+    if ENUMERATOR_WANTARRAY
       assert_warn(/block not used/) {
         assert_equal ["A", "B", "C"], s.chars {}
       }
@@ -772,7 +773,7 @@ class TestString < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_string.rb#L773
     assert_equal ["hello\n", "world"], s.lines
     assert_equal ["hello\nworld"], s.lines(nil)
 
-    if RUBY_VERSION >= "2.1.0"
+    if ENUMERATOR_WANTARRAY
       assert_warn(/block not used/) {
         assert_equal ["hello\n", "world"], s.lines {}
       }

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

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