mirror of
https://github.com/servo/servo.git
synced 2025-08-17 03:15:34 +01:00
Format remaining files
This commit is contained in:
parent
bf47f90da6
commit
cb07debcb6
252 changed files with 5944 additions and 3744 deletions
|
@ -23,7 +23,7 @@ fn test_parse_double() {
|
|||
let value = String::from("432.5e2");
|
||||
match AttrValue::from_double(value, 0.0) {
|
||||
AttrValue::Double(_, num) => assert_eq!(num, 43250f64),
|
||||
_ => panic!("expected a double value")
|
||||
_ => panic!("expected a double value"),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ fn test_parse_double_negative_prefix() {
|
|||
let value = String::from("-5.6");
|
||||
match AttrValue::from_double(value, 0.0) {
|
||||
AttrValue::Double(_, num) => assert_eq!(num, -5.6f64),
|
||||
_ => panic!("expected a double value")
|
||||
_ => panic!("expected a double value"),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ fn test_parse_double_positive_prefix() {
|
|||
let value = String::from("+5.6");
|
||||
match AttrValue::from_double(value, 0.0) {
|
||||
AttrValue::Double(_, num) => assert_eq!(num, 5.6f64),
|
||||
_ => panic!("expected a double value")
|
||||
_ => panic!("expected a double value"),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ fn test_from_limited_i32_should_be_default_when_less_than_0() {
|
|||
let value = String::from("-1");
|
||||
match AttrValue::from_limited_i32(value, 0) {
|
||||
AttrValue::Int(_, 0) => (),
|
||||
_ => panic!("expected an IndexSize error")
|
||||
_ => panic!("expected an IndexSize error"),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -58,17 +58,15 @@ fn test_from_limited_i32_should_be_default_when_less_than_0() {
|
|||
fn test_from_limited_i32_should_parse_a_uint_when_value_is_0_or_greater() {
|
||||
match AttrValue::from_limited_i32(String::from("1"), 0) {
|
||||
AttrValue::Int(_, 1) => (),
|
||||
_ => panic!("expected an successful parsing")
|
||||
_ => panic!("expected an successful parsing"),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_from_limited_i32_should_keep_parsed_value_when_not_an_int() {
|
||||
match AttrValue::from_limited_i32(String::from("parsed-value"), 0) {
|
||||
AttrValue::Int(p, 0) => {
|
||||
assert_eq!(p, String::from("parsed-value"))
|
||||
},
|
||||
_ => panic!("expected an successful parsing")
|
||||
AttrValue::Int(p, 0) => assert_eq!(p, String::from("parsed-value")),
|
||||
_ => panic!("expected an successful parsing"),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,7 +80,13 @@ pub fn test_parse_length() {
|
|||
check("0", LengthOrPercentageOrAuto::Length(Au::from_px(0)));
|
||||
check("0.000%", LengthOrPercentageOrAuto::Percentage(0.0));
|
||||
check("+5.82%", LengthOrPercentageOrAuto::Percentage(0.0582));
|
||||
check("5.82", LengthOrPercentageOrAuto::Length(Au::from_f64_px(5.82)));
|
||||
check(
|
||||
"5.82",
|
||||
LengthOrPercentageOrAuto::Length(Au::from_f64_px(5.82)),
|
||||
);
|
||||
check("invalid", LengthOrPercentageOrAuto::Auto);
|
||||
check("12 followed by invalid", LengthOrPercentageOrAuto::Length(Au::from_px(12)));
|
||||
check(
|
||||
"12 followed by invalid",
|
||||
LengthOrPercentageOrAuto::Length(Au::from_px(12)),
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue