summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-05-22 07:27:02 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-05-22 07:27:02 (GMT)
commit006634b4891fdf274bfa212ed74e696280a5d2dd (patch)
treea9993326ab7c38cff3827792b6d50a3c1a6d164a /test
parent78c5ca70744e85f8468147ddc362962bcd987d30 (diff)
-test-/integer
* ext/-test-/integer/core_ext.c: move testutil/integer.c. * test/lib/-test-/integer.rb: extract implementation details from test/unit/assertions.rb. [Bug #12408] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55114 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/-ext-/integer/test_integer.rb1
-rw-r--r--test/-ext-/num2int/test_num2int.rb1
-rw-r--r--test/lib/-test-/integer.rb14
-rw-r--r--test/lib/test/unit.rb1
-rw-r--r--test/lib/test/unit/assertions.rb10
-rw-r--r--test/ruby/test_bignum.rb5
6 files changed, 21 insertions, 11 deletions
diff --git a/test/-ext-/integer/test_integer.rb b/test/-ext-/integer/test_integer.rb
index 6ea42e3..000cb78 100644
--- a/test/-ext-/integer/test_integer.rb
+++ b/test/-ext-/integer/test_integer.rb
@@ -1,5 +1,6 @@
# frozen_string_literal: false
require 'test/unit'
+require '-test-/integer'
class TestInteger < Test::Unit::TestCase
FIXNUM_MIN = Integer::FIXNUM_MIN
diff --git a/test/-ext-/num2int/test_num2int.rb b/test/-ext-/num2int/test_num2int.rb
index da3bf97..8eedc50 100644
--- a/test/-ext-/num2int/test_num2int.rb
+++ b/test/-ext-/num2int/test_num2int.rb
@@ -1,6 +1,7 @@
# frozen_string_literal: false
require 'test/unit'
require '-test-/num2int'
+require '-test-/integer'
class TestNum2int < Test::Unit::TestCase
SHRT_MIN = -32768
diff --git a/test/lib/-test-/integer.rb b/test/lib/-test-/integer.rb
new file mode 100644
index 0000000..a224148
--- /dev/null
+++ b/test/lib/-test-/integer.rb
@@ -0,0 +1,14 @@
+require 'test/unit'
+require '-test-/integer.so'
+
+module Test::Unit::Assertions
+ def assert_fixnum(v, msg=nil)
+ assert_instance_of(Integer, v, msg)
+ assert_predicate(v, :fixnum?, msg)
+ end
+
+ def assert_bignum(v, msg=nil)
+ assert_instance_of(Integer, v, msg)
+ assert_predicate(v, :bignum?, msg)
+ end
+end
diff --git a/test/lib/test/unit.rb b/test/lib/test/unit.rb
index df7070e..d34e11a 100644
--- a/test/lib/test/unit.rb
+++ b/test/lib/test/unit.rb
@@ -8,7 +8,6 @@ require 'test/unit/assertions'
require_relative '../envutil'
require 'test/unit/testcase'
require 'optparse'
-require '-test-/testutil'
# See Test::Unit
module Test
diff --git a/test/lib/test/unit/assertions.rb b/test/lib/test/unit/assertions.rb
index 2a75871..91532e8 100644
--- a/test/lib/test/unit/assertions.rb
+++ b/test/lib/test/unit/assertions.rb
@@ -771,16 +771,6 @@ eom
values
end
- def assert_fixnum(v, msg=nil)
- assert_instance_of(Integer, v, msg)
- assert_predicate(v, :fixnum?, msg)
- end
-
- def assert_bignum(v, msg=nil)
- assert_instance_of(Integer, v, msg)
- assert_predicate(v, :bignum?, msg)
- end
-
class << (AssertFile = Struct.new(:failure_message).new)
include Assertions
def assert_file_predicate(predicate, *args)
diff --git a/test/ruby/test_bignum.rb b/test/ruby/test_bignum.rb
index 7760062..e19c320 100644
--- a/test/ruby/test_bignum.rb
+++ b/test/ruby/test_bignum.rb
@@ -1,5 +1,9 @@
# frozen_string_literal: false
require 'test/unit'
+begin
+ require '-test-/integer'
+rescue LoadError
+else
class TestBignum < Test::Unit::TestCase
FIXNUM_MIN = Integer::FIXNUM_MIN
@@ -734,3 +738,4 @@ class TestBignum < Test::Unit::TestCase
assert_equal(T1024 ^ 10, T1024 ^ obj)
end
end
+end