summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-05-22 07:27:02 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-05-22 07:27:02 +0000
commit006634b4891fdf274bfa212ed74e696280a5d2dd (patch)
treea9993326ab7c38cff3827792b6d50a3c1a6d164a
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
-rw-r--r--ChangeLog7
-rw-r--r--ext/-test-/integer/core_ext.c (renamed from ext/-test-/testutil/integer.c)2
-rw-r--r--ext/-test-/testutil/extconf.rb8
-rw-r--r--ext/-test-/testutil/init.c11
-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
10 files changed, 29 insertions, 31 deletions
diff --git a/ChangeLog b/ChangeLog
index 705e6f6..641c500 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Sun May 22 16:27:00 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * 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]
+
Sun May 22 14:57:43 2016 Martin Duerst <duerst@it.aoyama.ac.jp>
* include/ruby/oniguruma.h: Extend OnigEncodingTypeDefine to define a
diff --git a/ext/-test-/testutil/integer.c b/ext/-test-/integer/core_ext.c
index da5812c..6d64cdb 100644
--- a/ext/-test-/testutil/integer.c
+++ b/ext/-test-/integer/core_ext.c
@@ -21,7 +21,7 @@ rb_int_to_bignum(VALUE x)
}
void
-Init_integer(VALUE klass)
+Init_core_ext(VALUE klass)
{
rb_define_method(rb_cInteger, "bignum?", int_bignum_p, 0);
rb_define_method(rb_cInteger, "fixnum?", int_fixnum_p, 0);
diff --git a/ext/-test-/testutil/extconf.rb b/ext/-test-/testutil/extconf.rb
deleted file mode 100644
index 157a3d6..0000000
--- a/ext/-test-/testutil/extconf.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-# frozen_string_literal: false
-$INCFLAGS << " -I$(topdir) -I$(top_srcdir)"
-$srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")]
-inits = $srcs.map {|s| File.basename(s, ".*")}
-inits.delete("init")
-inits.map! {|s|"X(#{s})"}
-$defs << "-DTEST_INIT_FUNCS(X)=\"#{inits.join(' ')}\""
-create_makefile("-test-/testutil")
diff --git a/ext/-test-/testutil/init.c b/ext/-test-/testutil/init.c
deleted file mode 100644
index cf2804d..0000000
--- a/ext/-test-/testutil/init.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include "ruby.h"
-
-#define init(n) {void Init_##n(VALUE klass); Init_##n(klass);}
-
-void
-Init_testutil(void)
-{
- VALUE mBug = rb_define_module("Bug");
- VALUE klass = rb_define_class_under(mBug, "TestUtil", rb_cObject);
- TEST_INIT_FUNCS(init);
-}
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