summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorywenc <[email protected]>2023-08-31 17:52:50 -0400
committerJohn Hawthorn <[email protected]>2023-09-01 16:23:28 -0700
commit2ca0f01015d076d966ab1b0f28700a4424b86da6 (patch)
tree240d5854f9ceb6badc24f09c08f1cd0bf866d454 /test/ruby
parente8ef5b1281b9dce518902b3451096164c30bca5c (diff)
Add regression tests for start_with?/delete_prefix
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/8348
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_string.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb
index 1d8902baf1..22bec09855 100644
--- a/test/ruby/test_string.rb
+++ b/test/ruby/test_string.rb
@@ -1939,6 +1939,7 @@ CODE
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]'
@@ -2933,6 +2934,8 @@ CODE
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