Skip to content

Commit a230079

Browse files
authored
Merge pull request #1210 from headius/spec_update_20241105
Spec update 20241105
2 parents eab1c59 + 287ac86 commit a230079

File tree

80 files changed

+1891
-230
lines changed

Some content is hidden

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

80 files changed

+1891
-230
lines changed

.mspec.constants

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ Prime
146146
Private
147147
ProcFromMethod
148148
Psych
149+
RactorLocalSingleton
149150
REXML
150151
RUBY_SIGNALS
151152
RbReadline

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ end
164164
platform_is_not :linux, :darwin do # Not Linux and not Darwin
165165
end
166166

167-
platform_is wordsize: 64 do
167+
platform_is pointer_size: 64 do
168168
# 64-bit platform
169169
end
170170

command_line/fixtures/debug_info.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# frozen_string_literal: true
21
a = 'string'
32
b = a
43
c = b

command_line/frozen_strings_spec.rb

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,18 @@
5757

5858
describe "The --debug flag produces" do
5959
it "debugging info on attempted frozen string modification" do
60-
error_str = ruby_exe(fixture(__FILE__, 'debug_info.rb'), options: '--debug', args: "2>&1")
60+
error_str = ruby_exe(fixture(__FILE__, 'debug_info.rb'), options: '--enable-frozen-string-literal --debug', args: "2>&1")
6161
error_str.should include("can't modify frozen String")
6262
error_str.should include("created at")
63-
error_str.should include("command_line/fixtures/debug_info.rb:2")
63+
error_str.should include("command_line/fixtures/debug_info.rb:1")
64+
end
65+
66+
guard -> { ruby_version_is "3.4" and !"test".frozen? } do
67+
it "debugging info on mutating chilled string" do
68+
error_str = ruby_exe(fixture(__FILE__, 'debug_info.rb'), options: '-w --debug', args: "2>&1")
69+
error_str.should include("literal string will be frozen in the future")
70+
error_str.should include("the string was created here")
71+
error_str.should include("command_line/fixtures/debug_info.rb:1")
72+
end
6473
end
6574
end

core/array/fetch_values_spec.rb

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
require_relative '../../spec_helper'
2+
require_relative 'fixtures/classes'
3+
4+
describe "Array#fetch_values" do
5+
before :each do
6+
@array = [:a, :b, :c]
7+
end
8+
9+
ruby_version_is "3.4" do
10+
describe "with matched indexes" do
11+
it "returns the values for indexes" do
12+
@array.fetch_values(0).should == [:a]
13+
@array.fetch_values(0, 2).should == [:a, :c]
14+
end
15+
16+
it "returns the values for indexes ordered in the order of the requested indexes" do
17+
@array.fetch_values(2, 0).should == [:c, :a]
18+
end
19+
end
20+
21+
describe "with unmatched indexes" do
22+
it "raises a index error if no block is provided" do
23+
-> { @array.fetch_values(0, 1, 44) }.should raise_error(IndexError)
24+
end
25+
26+
it "returns the default value from block" do
27+
@array.fetch_values(44) { |index| "`#{index}' is not found" }.should == ["`44' is not found"]
28+
@array.fetch_values(0, 44) { |index| "`#{index}' is not found" }.should == [:a, "`44' is not found"]
29+
end
30+
end
31+
32+
describe "without keys" do
33+
it "returns an empty Array" do
34+
@array.fetch_values.should == []
35+
end
36+
end
37+
38+
it "tries to convert the passed argument to an Integer using #to_int" do
39+
obj = mock('to_int')
40+
obj.should_receive(:to_int).and_return(2)
41+
@array.fetch_values(obj).should == [:c]
42+
end
43+
44+
it "raises a TypeError when the passed argument can't be coerced to Integer" do
45+
-> { [].fetch_values("cat") }.should raise_error(TypeError)
46+
end
47+
end
48+
end

core/array/pack/l_spec.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
it_behaves_like :array_pack_32bit_be, 'L>'
3030
end
3131

32-
platform_is wordsize: 32 do
32+
platform_is c_long_size: 32 do
3333
describe "with modifier '<' and '_'" do
3434
it_behaves_like :array_pack_32bit_le, 'L<_'
3535
it_behaves_like :array_pack_32bit_le, 'L_<'
@@ -51,7 +51,7 @@
5151
end
5252
end
5353

54-
platform_is wordsize: 64 do
54+
platform_is c_long_size: 64 do
5555
describe "with modifier '<' and '_'" do
5656
it_behaves_like :array_pack_64bit_le, 'L<_'
5757
it_behaves_like :array_pack_64bit_le, 'L_<'
@@ -83,7 +83,7 @@
8383
it_behaves_like :array_pack_32bit_be, 'l>'
8484
end
8585

86-
platform_is wordsize: 32 do
86+
platform_is c_long_size: 32 do
8787
describe "with modifier '<' and '_'" do
8888
it_behaves_like :array_pack_32bit_le, 'l<_'
8989
it_behaves_like :array_pack_32bit_le, 'l_<'
@@ -105,7 +105,7 @@
105105
end
106106
end
107107

108-
platform_is wordsize: 64 do
108+
platform_is c_long_size: 64 do
109109
describe "with modifier '<' and '_'" do
110110
it_behaves_like :array_pack_64bit_le, 'l<_'
111111
it_behaves_like :array_pack_64bit_le, 'l_<'
@@ -137,7 +137,7 @@
137137
it_behaves_like :array_pack_32bit_le, 'l'
138138
end
139139

140-
platform_is wordsize: 32 do
140+
platform_is c_long_size: 32 do
141141
describe "Array#pack with format 'L' with modifier '_'" do
142142
it_behaves_like :array_pack_32bit_le, 'L_'
143143
end
@@ -155,7 +155,7 @@
155155
end
156156
end
157157

158-
platform_is wordsize: 64 do
158+
platform_is c_long_size: 64 do
159159
describe "Array#pack with format 'L' with modifier '_'" do
160160
it_behaves_like :array_pack_64bit_le, 'L_'
161161
end
@@ -183,7 +183,7 @@
183183
it_behaves_like :array_pack_32bit_be, 'l'
184184
end
185185

186-
platform_is wordsize: 32 do
186+
platform_is c_long_size: 32 do
187187
describe "Array#pack with format 'L' with modifier '_'" do
188188
it_behaves_like :array_pack_32bit_be, 'L_'
189189
end
@@ -201,7 +201,7 @@
201201
end
202202
end
203203

204-
platform_is wordsize: 64 do
204+
platform_is c_long_size: 64 do
205205
describe "Array#pack with format 'L' with modifier '_'" do
206206
it_behaves_like :array_pack_64bit_be, 'L_'
207207
end

core/array/pack/shared/integer.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@
273273
str.should == "\x78\x65\x43\x12\xcd\xab\xf0\xde\x21\x43\x65\x78"
274274
end
275275

276-
platform_is wordsize: 64 do
276+
platform_is c_long_size: 64 do
277277
it "encodes the least significant 32 bits of a number that is greater than 32 bits" do
278278
[ [[0xff_7865_4321], "\x21\x43\x65\x78"],
279279
[[-0xff_7865_4321], "\xdf\xbc\x9a\x87"]
@@ -299,7 +299,7 @@
299299
str.should == "\x12\x43\x65\x78\xde\xf0\xab\xcd\x78\x65\x43\x21"
300300
end
301301

302-
platform_is wordsize: 64 do
302+
platform_is c_long_size: 64 do
303303
it "encodes the least significant 32 bits of a number that is greater than 32 bits" do
304304
[ [[0xff_7865_4321], "\x78\x65\x43\x21"],
305305
[[-0xff_7865_4321], "\x87\x9a\xbc\xdf"]

0 commit comments

Comments
 (0)