Skip to content

Commit

Permalink
Add regression tests for start_with?/delete_prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
ywenc authored and jhawthorn committed Sep 1, 2023
1 parent e8ef5b1 commit 2ca0f01
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions test/ruby/test_string.rb
Expand Up @@ -1939,6 +1939,7 @@ def test_start_with?
assert_not_send([S("hello"), :start_with?, S("el")])
assert_send([S("hello"), :start_with?, S("el"), S("he")])
assert_send([S("\xFF\xFE"), :start_with?, S("\xFF")])
assert_send([S("hello\xBE"), :start_with?, S("hello")])
assert_not_send([S("\u{c4}"), :start_with?, S("\xC3")])

bug5536 = '[ruby-core:40623]'
Expand Down Expand Up @@ -2933,6 +2934,8 @@ def test_delete_prefix_broken_encoding
assert_equal("\x95\x5c".force_encoding("Shift_JIS"), s)

assert_equal("\xFE", S("\xFF\xFE").delete_prefix("\xFF"))
assert_equal("\xBE", S("hello\xBE").delete_prefix("hello"))
assert_equal("\xBE", S("\xFFhello\xBE").delete_prefix("\xFFhello"))
end

def test_delete_prefix_clear_coderange
Expand Down

0 comments on commit 2ca0f01

Please sign in to comment.