Add a test for #3030

This commit is contained in:
Seiichi Uchida 2018-10-01 00:06:37 +09:00
parent 4c1b0c2241
commit efe24bd7e7
2 changed files with 27 additions and 0 deletions

View file

@ -521,3 +521,18 @@ fn issue_3040() {
}
}
}
// #3030
fn issue_3030() {
match input.trim().parse::<f64>() {
Ok(val)
if !(
// A valid number is the same as what rust considers to be valid,
// except for +1., NaN, and Infinity.
val.is_infinite() || val
.is_nan() || input.ends_with(".") || input.starts_with("+")
)
=> {
}
}
}

View file

@ -552,3 +552,15 @@ fn issue_3040() {
}
}
}
// #3030
fn issue_3030() {
match input.trim().parse::<f64>() {
Ok(val)
if !(
// A valid number is the same as what rust considers to be valid,
// except for +1., NaN, and Infinity.
val.is_infinite() || val.is_nan() || input.ends_with(".") || input.starts_with("+")
) => {}
}
}