mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
account for sign in double parsing
When sign was present during double parsing correctly jump forward the extra character when parsing fraction and exponent.
This commit is contained in:
parent
3401361461
commit
f3079e8728
2 changed files with 24 additions and 6 deletions
|
@ -14,6 +14,24 @@ fn test_parse_double() {
|
|||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
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")
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
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")
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_from_limited_i32_should_be_default_when_less_than_0() {
|
||||
let value = String::from("-1");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue