Skip to content

Commit

Permalink
Fix test of bytesplice
Browse files Browse the repository at this point in the history
  • Loading branch information
soutaro committed Dec 8, 2023
1 parent c189a40 commit 88405d5
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions test/stdlib/String_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -382,31 +382,23 @@ def test_bytesplice
# supported in 3.3 and onwards use `self`. If we ever stop supporting 3.2, we can remove this.

with_string ', world! :-D' do |string|
with_int 1 do |start|
with_int 2 do |length|
assert_send_type "(int, int, string) -> String",
+'hello', :bytesplice, start, length, string

next if RUBY_VERSION < '3.3'

with_int 3 do |str_start|
with_int 4 do |str_length|
assert_send_type '(int, int, string, int, int) -> String',
+'hello', :bytesplice, start, length, string, str_start, str_length
end
end
end
assert_send_type "(Integer, Integer, string) -> String",
+'hello', :bytesplice, 1, 2, string

if RUBY_VERSION >= "3.3.0"
assert_send_type '(Integer, Integer, string, Integer, Integer) -> String',
+'hello', :bytesplice, 1, 2, string, 3, 4
end

with_range with_int(1).and_nil, with_int(2).and_nil do |range|
assert_send_type "(range[int?], string) -> String",
+'hello', :bytesplice, range, string

next if RUBY_VERSION < '3.3'

with_range with_int(3).and_nil, with_int(4).and_nil do |string_range|
if RUBY_VERSION >= '3.3.0'
with_range with_int(3).and_nil, with_int(4).and_nil do |string_range|
assert_send_type '(range[int?], string, range[int?]) -> String',
+'hello', :bytesplice, range, string, string_range
end
end
end
end
Expand Down

0 comments on commit 88405d5

Please sign in to comment.