Skip to content

Commit e0c5488

Browse files
committed
1 parent bb5f710 commit e0c5488

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+531
-137
lines changed

spec/ruby/core/dir/fixtures/common.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ def self.mock_dir_files
9494
special/こんにちは.txt
9595
special/\a
9696
]
97+
@mock_dir_files << "special/_\u{1f60e}.erb"
9798
end
9899
end
99100

spec/ruby/core/dir/read_spec.rb

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,38 @@
3939
entries.sort.should == DirSpecs.expected_paths
4040
end
4141

42+
platform_is_not :windows do
43+
it "returns all directory entries even when encoding conversion will fail" do
44+
dir = Dir.open(File.join(DirSpecs.mock_dir, 'special'))
45+
utf8_entries = []
46+
begin
47+
while entry = dir.read
48+
utf8_entries << entry
49+
end
50+
ensure
51+
dir.close
52+
end
53+
old_internal_encoding = Encoding::default_internal
54+
old_external_encoding = Encoding::default_external
55+
Encoding.default_internal = Encoding::UTF_8
56+
Encoding.default_external = Encoding::SHIFT_JIS
57+
dir = Dir.open(File.join(DirSpecs.mock_dir, 'special'))
58+
shift_jis_entries = []
59+
begin
60+
-> {
61+
while entry = dir.read
62+
shift_jis_entries << entry
63+
end
64+
}.should_not raise_error
65+
ensure
66+
dir.close
67+
Encoding.default_internal = old_internal_encoding
68+
Encoding.default_external = old_external_encoding
69+
end
70+
shift_jis_entries.size.should == utf8_entries.size
71+
shift_jis_entries.filter { |f| f.encoding == Encoding::SHIFT_JIS }.size.should == 1
72+
end
73+
end
74+
4275
it_behaves_like :dir_closed, :read
4376
end

spec/ruby/core/enumerable/all_spec.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@
131131
pattern.yielded.should == [[0], [1], [2], [-1]]
132132
end
133133

134-
# may raise an exception in future versions
135134
it "always returns true on empty enumeration" do
136135
@empty.all?(Integer).should == true
137136
[].all?(Integer).should == true

spec/ruby/core/enumerable/any_spec.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@
145145
pattern.yielded.should == [[0], [1], [2]]
146146
end
147147

148-
# may raise an exception in future versions
149148
it "always returns false on empty enumeration" do
150149
@empty.any?(Integer).should == false
151150
[].any?(Integer).should == false

spec/ruby/core/enumerable/none_spec.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@
100100
pattern.yielded.should == [[0], [1], [2], [-1]]
101101
end
102102

103-
# may raise an exception in future versions
104103
it "always returns true on empty enumeration" do
105104
@empty.none?(Integer).should == true
106105
[].none?(Integer).should == true

spec/ruby/core/enumerable/one_spec.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@
9191
pattern.yielded.should == [[0], [1], [2], [-1]]
9292
end
9393

94-
# may raise an exception in future versions
9594
it "always returns false on empty enumeration" do
9695
@empty.one?(Integer).should == false
9796
[].one?(Integer).should == false

spec/ruby/core/float/coerce_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
1.0.coerce(3.14).should == [3.14, 1.0]
1010

1111
a, b = -0.0.coerce(bignum_value)
12-
a.should be_close(9223372036854775808.0, TOLERANCE)
12+
a.should be_close(18446744073709551616.0, TOLERANCE)
1313
b.should be_close(-0.0, TOLERANCE)
1414
a, b = 1.0.coerce(bignum_value)
15-
a.should be_close(9223372036854775808.0, TOLERANCE)
15+
a.should be_close(18446744073709551616.0, TOLERANCE)
1616
b.should be_close(1.0, TOLERANCE)
1717
end
1818
end

spec/ruby/core/float/divmod_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
values[1].should be_close(2.8284, TOLERANCE)
1111
values = -1.0.divmod(bignum_value)
1212
values[0].should eql(-1)
13-
values[1].should be_close(9223372036854775808.000, TOLERANCE)
13+
values[1].should be_close(18446744073709551616.0, TOLERANCE)
1414
values = -1.0.divmod(1)
1515
values[0].should eql(-1)
1616
values[1].should eql(0.0)

spec/ruby/core/float/minus_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
it "returns self minus other" do
88
(9_237_212.5280 - 5_280).should be_close(9231932.528, TOLERANCE)
9-
(2_560_496.1691 - bignum_value).should be_close(-9223372036852215808.000, TOLERANCE)
9+
(2_560_496.1691 - bignum_value).should be_close(-18446744073706991616.0, TOLERANCE)
1010
(5.5 - 5.5).should be_close(0.0,TOLERANCE)
1111
end
1212
end

spec/ruby/core/float/multiply_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
it "returns self multiplied by other" do
88
(4923.98221 * 2).should be_close(9847.96442, TOLERANCE)
99
(6712.5 * 0.25).should be_close(1678.125, TOLERANCE)
10-
(256.4096 * bignum_value).should be_close(2364961134621118431232.000, TOLERANCE)
10+
(256.4096 * bignum_value).should be_close(4729922269242236862464.0, TOLERANCE)
1111
end
1212

1313
it "raises a TypeError when given a non-Numeric" do

0 commit comments

Comments
 (0)