summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authork0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-01-03 05:19:05 +0000
committerk0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-01-03 05:19:05 +0000
commit2fd6ed62b4826c03bd6d41ae99a5bd7fecafec40 (patch)
tree46e4a0eda0a87dba2e66ad2197245781483bd33d /test
parent3bc28f49330cc3114d39552399bf38aa31c19aa4 (diff)
test_complex.rb: fix tests for RUBYOPT="-w"
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66693 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_complex.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ruby/test_complex.rb b/test/ruby/test_complex.rb
index 98ed42dae9..d85929f4cc 100644
--- a/test/ruby/test_complex.rb
+++ b/test/ruby/test_complex.rb
@@ -317,9 +317,11 @@ class Complex_Test < Test::Unit::TestCase
def test_sub_with_redefining_int_minus
assert_in_out_err([], <<-'end;', ['true'], [])
+ $VERBOSE, verbose = nil, $VERBOSE
class Integer
def -(other); 42; end
end
+ $VERBOSE = verbose
a = Complex(1, 2) - Complex(0, 1)
puts a == Complex(42, 42)
end;
@@ -327,9 +329,11 @@ class Complex_Test < Test::Unit::TestCase
def test_sub_with_redefining_float_minus
assert_in_out_err([], <<-'end;', ['true'], [])
+ $VERBOSE, verbose = nil, $VERBOSE
class Float
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;
@@ -337,9 +341,11 @@ class Complex_Test < Test::Unit::TestCase
def test_sub_with_redefining_rational_minus
assert_in_out_err([], <<-'end;', ['true'], [])
+ $VERBOSE, verbose = nil, $VERBOSE
class Rational
def -(other); 355/113r; end
end
+ $VERBOSE = verbose
a = Complex(1r, 2r) - Complex(0, 1)
puts a == Complex(355/113r, 355/113r)
end;
@@ -369,9 +375,11 @@ class Complex_Test < Test::Unit::TestCase
def test_mul_with_redefining_int_mult
assert_in_out_err([], <<-'end;', ['true'], [])
+ $VERBOSE, verbose = nil, $VERBOSE
class Integer
def *(other); 42; end
end
+ $VERBOSE = verbose
a = Complex(2, 0) * Complex(1, 2)
puts a == Complex(0, 84)
end;
@@ -379,9 +387,11 @@ class Complex_Test < Test::Unit::TestCase
def test_mul_with_redefining_float_mult
assert_in_out_err([], <<-'end;', ['true'], [])
+ $VERBOSE, verbose = nil, $VERBOSE
class Float
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;
@@ -390,9 +400,11 @@ class Complex_Test < Test::Unit::TestCase
def test_mul_with_redefining_rational_mult
assert_in_out_err([], <<-'end;', ['true'], [])
+ $VERBOSE, verbose = nil, $VERBOSE
class Rational
def *(other); 355/113r; end
end
+ $VERBOSE = verbose
a = Complex(2r, 0r) * Complex(1, 2)
puts a == Complex(0r, 2*355/113r)
end;