mirror of
https://github.com/servo/servo.git
synced 2025-08-12 08:55:32 +01:00
cow_to_ascii_lowercase()
This commit is contained in:
parent
120b003195
commit
97344b150d
5 changed files with 27 additions and 1 deletions
|
@ -16,6 +16,7 @@ testing = ["style/testing"]
|
|||
app_units = "0.3"
|
||||
cssparser = {version = "0.7", features = ["heap_size"]}
|
||||
euclid = "0.10.1"
|
||||
matches = "0.1"
|
||||
owning_ref = "0.2.2"
|
||||
parking_lot = "0.3"
|
||||
rustc-serialize = "0.3"
|
||||
|
|
|
@ -10,6 +10,7 @@ extern crate app_units;
|
|||
extern crate cssparser;
|
||||
extern crate euclid;
|
||||
#[macro_use] extern crate html5ever_atoms;
|
||||
#[macro_use] #[allow(unused_extern_crates)] extern crate matches;
|
||||
extern crate owning_ref;
|
||||
extern crate parking_lot;
|
||||
extern crate rustc_serialize;
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
* 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 std::borrow::Cow;
|
||||
use style::str::{split_html_space_chars, str_join, cow_into_ascii_lowercase};
|
||||
|
||||
#[test]
|
||||
pub fn split_html_space_chars_whitespace() {
|
||||
|
@ -33,3 +34,13 @@ pub fn test_str_join_many() {
|
|||
let expected = "-alpha--beta-gamma-";
|
||||
assert_eq!(actual, expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
pub fn test_cow_into_ascii_lowercase() {
|
||||
assert!(matches!(cow_into_ascii_lowercase("abc.d"), Cow::Borrowed("abc.d")));
|
||||
let string = String::from("abc.d");
|
||||
assert!(matches!(cow_into_ascii_lowercase(string), Cow::Owned(ref s) if s == "abc.d"));
|
||||
assert!(matches!(cow_into_ascii_lowercase("Abc.d"), Cow::Owned(ref s) if s == "abc.d"));
|
||||
assert!(matches!(cow_into_ascii_lowercase("aBC.D"), Cow::Owned(ref s) if s == "abc.d"));
|
||||
assert!(matches!(cow_into_ascii_lowercase("abc.D"), Cow::Owned(ref s) if s == "abc.d"));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue