mirror of
https://github.com/servo/servo.git
synced 2025-08-16 10:55:34 +01:00
style: Fix starts_with_ignore_ascii_case.
In particular, fix a panic when the input is not ASCII and we happen to index in something that is not a char boundary. This fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1379380
This commit is contained in:
parent
1425ad1bab
commit
d8a22d8bd7
2 changed files with 7 additions and 2 deletions
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use style::str::{split_html_space_chars, str_join};
|
||||
use style::str::{split_html_space_chars, str_join, starts_with_ignore_ascii_case};
|
||||
|
||||
#[test]
|
||||
pub fn split_html_space_chars_whitespace() {
|
||||
|
@ -33,3 +33,8 @@ pub fn test_str_join_many() {
|
|||
let expected = "-alpha--beta-gamma-";
|
||||
assert_eq!(actual, expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
pub fn test_starts_with_ignore_ascii_case_char_boundary() {
|
||||
assert!(!starts_with_ignore_ascii_case("aaaaa💩", "-webkit-"));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue