Add regression tests for start_with?/delete_prefix

This commit is contained in:
ywenc 2023-08-31 17:52:50 -04:00 committed by John Hawthorn
parent e8ef5b1281
commit 2ca0f01015
Notes: git 2023-09-01 23:23:49 +00:00

View File

@ -1939,6 +1939,7 @@ CODE
assert_not_send([S("hello"), :start_with?, S("el")]) assert_not_send([S("hello"), :start_with?, S("el")])
assert_send([S("hello"), :start_with?, S("el"), S("he")]) assert_send([S("hello"), :start_with?, S("el"), S("he")])
assert_send([S("\xFF\xFE"), :start_with?, S("\xFF")]) 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")]) assert_not_send([S("\u{c4}"), :start_with?, S("\xC3")])
bug5536 = '[ruby-core:40623]' bug5536 = '[ruby-core:40623]'
@ -2933,6 +2934,8 @@ CODE
assert_equal("\x95\x5c".force_encoding("Shift_JIS"), s) assert_equal("\x95\x5c".force_encoding("Shift_JIS"), s)
assert_equal("\xFE", S("\xFF\xFE").delete_prefix("\xFF")) 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 end
def test_delete_prefix_clear_coderange def test_delete_prefix_clear_coderange