From 12e6cf77efae6804063dbebe84e4080ca78958e7 Mon Sep 17 00:00:00 2001 From: Alan Wu Date: Tue, 23 Jul 2024 18:14:45 -0400 Subject: Add "c_long_size" guard, supplanting "wordsize" and stop using Integer#size What a "word" is when talking about sizes is confusing because it's a highly overloaded term. Intel, Microsoft, and GDB are just a few vendors that have their own definition of what a "word" is. Specs that used the "wordsize" guard actually were mostly testing for the size of the C `long` fundamental type, so rename the guard for clarity. Also, get the size of `long` directly from RbConfig instead of guessing using Integer#size. Integer#size is not guaranteed to have anything to do with the `long` type. --- spec/ruby/shared/string/times.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'spec/ruby/shared/string') diff --git a/spec/ruby/shared/string/times.rb b/spec/ruby/shared/string/times.rb index aaf748bad9..4814f894cf 100644 --- a/spec/ruby/shared/string/times.rb +++ b/spec/ruby/shared/string/times.rb @@ -44,13 +44,13 @@ describe :string_times, shared: true do result.encoding.should equal(Encoding::UTF_8) end - platform_is wordsize: 32 do + platform_is c_long_size: 32 do it "raises an ArgumentError if the length of the resulting string doesn't fit into a long" do -> { @object.call("abc", (2 ** 31) - 1) }.should raise_error(ArgumentError) end end - platform_is wordsize: 64 do + platform_is c_long_size: 64 do it "raises an ArgumentError if the length of the resulting string doesn't fit into a long" do -> { @object.call("abc", (2 ** 63) - 1) }.should raise_error(ArgumentError) end -- cgit v1.2.3