Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
456 changed files
with
12,965 additions
and
3,574 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# frozen_string_literal: false | ||
require 'test/unit' | ||
require '-test-/integer' | ||
|
||
class TestInteger < Test::Unit::TestCase | ||
FIXNUM_MIN = Integer::FIXNUM_MIN | ||
FIXNUM_MAX = Integer::FIXNUM_MAX | ||
|
||
def test_fixnum_range | ||
assert_bignum(FIXNUM_MIN-1) | ||
assert_fixnum(FIXNUM_MIN) | ||
assert_fixnum(FIXNUM_MAX) | ||
assert_bignum(FIXNUM_MAX+1) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# frozen_string_literal: false | ||
require 'test/unit' | ||
require "-test-/integer" | ||
|
||
class TestIntegerExt < Test::Unit::TestCase | ||
def test_my_integer_to_f | ||
assert_raise(NotImplementedError) do | ||
Bug::Integer::MyInteger.new.to_f | ||
end | ||
|
||
begin | ||
Bug::Integer::MyInteger.class_eval do | ||
def to_f | ||
end | ||
end | ||
|
||
assert_nothing_raised do | ||
Bug::Integer::MyInteger.new.to_f | ||
end | ||
ensure | ||
Bug::Integer::MyInteger.class_eval do | ||
remove_method :to_f | ||
end | ||
end | ||
end | ||
|
||
def test_my_integer_cmp | ||
assert_raise(NotImplementedError) do | ||
Bug::Integer::MyInteger.new <=> 0 | ||
end | ||
|
||
begin | ||
Bug::Integer::MyInteger.class_eval do | ||
def <=>(other) | ||
0 | ||
end | ||
end | ||
|
||
assert_nothing_raised do | ||
Bug::Integer::MyInteger.new <=> 0 | ||
end | ||
ensure | ||
Bug::Integer::MyInteger.class_eval do | ||
remove_method :<=> | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ def foo2(a,b) | |
end | ||
end | ||
|
||
class B<A | ||
class B < A | ||
private :foo1, :foo2 | ||
end | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# frozen_string_literal: true | ||
require 'test/unit' | ||
require '-test-/string' | ||
require 'rbconfig/sizeof' | ||
|
||
class Test_StringCapacity < Test::Unit::TestCase | ||
def capa(str) | ||
Bug::String.capacity(str) | ||
end | ||
|
||
def test_capacity_embeded | ||
size = RbConfig::SIZEOF['void*'] * 3 - 1 | ||
assert_equal size, capa('foo') | ||
end | ||
|
||
def test_capacity_shared | ||
assert_equal 0, capa(:abcdefghijklmnopqrstuvwxyz.to_s) | ||
end | ||
|
||
def test_capacity_normal | ||
assert_equal 128, capa('1'*128) | ||
end | ||
|
||
def test_s_new_capacity | ||
assert_equal("", String.new(capacity: 1000)) | ||
assert_equal(String, String.new(capacity: 1000).class) | ||
assert_equal(10000, capa(String.new(capacity: 10000))) | ||
|
||
assert_equal("", String.new(capacity: -1000)) | ||
assert_equal(capa(String.new(capacity: -10000)), capa(String.new(capacity: -1000))) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
require "-test-/symbol" | ||
|
||
module Test_Symbol | ||
module NonInterned | ||
module_function | ||
|
||
def noninterned_name(prefix = "") | ||
prefix += "_#{Thread.current.object_id.to_s(36).tr('-', '_')}" | ||
begin | ||
name = "#{prefix}_#{rand(0x1000).to_s(16)}_#{Time.now.usec}" | ||
end while Bug::Symbol.find(name) | ||
name | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.