From efe24bd7e7d5718cf572efe7062affaa76f6508f Mon Sep 17 00:00:00 2001 From: Seiichi Uchida Date: Mon, 1 Oct 2018 00:06:37 +0900 Subject: [PATCH] Add a test for #3030 --- tests/source/match.rs | 15 +++++++++++++++ tests/target/match.rs | 12 ++++++++++++ 2 files changed, 27 insertions(+) diff --git a/tests/source/match.rs b/tests/source/match.rs index db73570dbdfd..1643449773e2 100644 --- a/tests/source/match.rs +++ b/tests/source/match.rs @@ -521,3 +521,18 @@ fn issue_3040() { } } } + +// #3030 +fn issue_3030() { + match input.trim().parse::() { + 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("+") + ) + => { + } + } +} diff --git a/tests/target/match.rs b/tests/target/match.rs index daa1f9f65dbf..130c9adfb3d5 100644 --- a/tests/target/match.rs +++ b/tests/target/match.rs @@ -552,3 +552,15 @@ fn issue_3040() { } } } + +// #3030 +fn issue_3030() { + match input.trim().parse::() { + 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("+") + ) => {} + } +}