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

ruby-changes:54479

From: k0kubun <ko1@a...>
Date: Thu, 3 Jan 2019 14:24:09 +0900 (JST)
Subject: [ruby-changes:54479] k0kubun:r66694 (trunk): test_complex.rb: use the same approach to fix failures

k0kubun	2019-01-03 14:24:05 +0900 (Thu, 03 Jan 2019)

  New Revision: 66694

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

  Log:
    test_complex.rb: use the same approach to fix failures
    
    as r66682.

  Modified files:
    trunk/test/ruby/test_complex.rb
Index: test/ruby/test_complex.rb
===================================================================
--- test/ruby/test_complex.rb	(revision 66693)
+++ test/ruby/test_complex.rb	(revision 66694)
@@ -317,11 +317,10 @@ class Complex_Test < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/test/ruby/test_complex.rb#L317
 
   def test_sub_with_redefining_int_minus
     assert_in_out_err([], <<-'end;', ['true'], [])
-      $VERBOSE, verbose = nil, $VERBOSE
       class Integer
+        remove_method :-
         def -(other); 42; end
       end
-      $VERBOSE = verbose
       a = Complex(1, 2) - Complex(0, 1)
       puts a == Complex(42, 42)
     end;
@@ -329,11 +328,10 @@ class Complex_Test < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/test/ruby/test_complex.rb#L328
 
   def test_sub_with_redefining_float_minus
     assert_in_out_err([], <<-'end;', ['true'], [])
-      $VERBOSE, verbose = nil, $VERBOSE
       class Float
+        remove_method :-
         def -(other); 42.0; end
       end
-      $VERBOSE = verbose
       a = Complex(1.0, 2.0) - Complex(0, 1)
       puts a == Complex(42.0, 42.0)
     end;
@@ -341,11 +339,10 @@ class Complex_Test < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/test/ruby/test_complex.rb#L339
 
   def test_sub_with_redefining_rational_minus
     assert_in_out_err([], <<-'end;', ['true'], [])
-      $VERBOSE, verbose = nil, $VERBOSE
       class Rational
+        remove_method :-
         def -(other); 355/113r; end
       end
-      $VERBOSE = verbose
       a = Complex(1r, 2r) - Complex(0, 1)
       puts a == Complex(355/113r, 355/113r)
     end;
@@ -375,11 +372,10 @@ class Complex_Test < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/test/ruby/test_complex.rb#L372
 
   def test_mul_with_redefining_int_mult
     assert_in_out_err([], <<-'end;', ['true'], [])
-      $VERBOSE, verbose = nil, $VERBOSE
       class Integer
+        remove_method :*
         def *(other); 42; end
       end
-      $VERBOSE = verbose
       a = Complex(2, 0) * Complex(1, 2)
       puts a == Complex(0, 84)
     end;
@@ -387,11 +383,10 @@ class Complex_Test < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/test/ruby/test_complex.rb#L383
 
   def test_mul_with_redefining_float_mult
     assert_in_out_err([], <<-'end;', ['true'], [])
-      $VERBOSE, verbose = nil, $VERBOSE
       class Float
+        remove_method :*
         def *(other); 42.0; end
       end
-      $VERBOSE = verbose
       a = Complex(2.0, 0.0) * Complex(1, 2)
       puts a == Complex(0.0, 84.0)
     end;
@@ -400,11 +395,10 @@ class Complex_Test < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/test/ruby/test_complex.rb#L395
 
   def test_mul_with_redefining_rational_mult
     assert_in_out_err([], <<-'end;', ['true'], [])
-      $VERBOSE, verbose = nil, $VERBOSE
       class Rational
+        remove_method :*
         def *(other); 355/113r; end
       end
-      $VERBOSE = verbose
       a = Complex(2r, 0r) * Complex(1, 2)
       puts a == Complex(0r, 2*355/113r)
     end;

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

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