summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-11-27 02:55:16 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-11-27 02:55:16 +0000
commit319f97adb9b88f4ff378618fea4d1968faedebeb (patch)
tree53d0c8dad357b9dac6635bbbe61bca6593b029a9 /test
parentaaa27526211c6a551bb3e7c11a04ed65910b2905 (diff)
merges r25067 from trunk into ruby_1_9_1 and added a test for it.
-- * lib/mathn.rb (Bignum#**): Fixed bignum**fixnum that was broken when requiring lib/mathn [ruby-core:25740] -- * test/test_mathn.rb (TestMathn): new test case. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@25949 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_complex.rb3
-rw-r--r--test/ruby/test_rational.rb3
-rw-r--r--test/test_mathn.rb10
3 files changed, 14 insertions, 2 deletions
diff --git a/test/ruby/test_complex.rb b/test/ruby/test_complex.rb
index b4be08ed91..33cafbde57 100644
--- a/test/ruby/test_complex.rb
+++ b/test/ruby/test_complex.rb
@@ -9,7 +9,8 @@ class Complex_Test < Test::Unit::TestCase
if @rational
@keiju = Rational.instance_variable_get('@RCS_ID')
end
- @unify = $".grep(/mathn/).size != 0
+ seps = [File::SEPARATOR, File::ALT_SEPARATOR].compact.map{|x| Regexp.escape(x)}.join("|")
+ @unify = $".grep(/(?:^|#{seps})mathn(?:\.(?:rb|so))?/).size != 0
end
def test_compsub
diff --git a/test/ruby/test_rational.rb b/test/ruby/test_rational.rb
index 8cacab9a09..37efc7b493 100644
--- a/test/ruby/test_rational.rb
+++ b/test/ruby/test_rational.rb
@@ -9,7 +9,8 @@ class Rational_Test < Test::Unit::TestCase
if @complex
@keiju = Complex.instance_variable_get('@RCS_ID')
end
- @unify = $".grep(/mathn/).size != 0
+ seps = [File::SEPARATOR, File::ALT_SEPARATOR].compact.map{|x| Regexp.escape(x)}.join("|")
+ @unify = $".grep(/(?:^|#{seps})mathn(?:\.(?:rb|so))?/).size != 0
end
def test_ratsub
diff --git a/test/test_mathn.rb b/test/test_mathn.rb
new file mode 100644
index 0000000000..d0bf03760d
--- /dev/null
+++ b/test/test_mathn.rb
@@ -0,0 +1,10 @@
+require 'test/unit'
+require_relative 'ruby/envutil'
+
+# mathn redefines too much. It must be isolated to child processes.
+class TestMathn < Test::Unit::TestCase
+ def test_power
+ assert_in_out_err ['-r', 'mathn', '-e', '1**2'], [], [], [], '[ruby-core:25740]'
+ assert_in_out_err ['-r', 'mathn', '-e', '(1<<126)**2'], [], [], [], '[ruby-core:25740]'
+ end
+end