mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
-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
This commit is contained in:
parent
78c5ca7074
commit
006634b489
10 changed files with 29 additions and 31 deletions
|
@ -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
|
||||
|
|
|
@ -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);
|
|
@ -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")
|
|
@ -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);
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
# frozen_string_literal: false
|
||||
require 'test/unit'
|
||||
require '-test-/integer'
|
||||
|
||||
class TestInteger < Test::Unit::TestCase
|
||||
FIXNUM_MIN = Integer::FIXNUM_MIN
|
||||
|
|
|
@ -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
|
||||
|
|
14
test/lib/-test-/integer.rb
Normal file
14
test/lib/-test-/integer.rb
Normal file
|
@ -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
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue