about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSeiichi Uchida <seuchida@gmail.com>2018-10-01 00:06:37 +0900
committerSeiichi Uchida <seuchida@gmail.com>2018-10-01 00:06:37 +0900
commitefe24bd7e7d5718cf572efe7062affaa76f6508f (patch)
treed1bbde06b0a519ef3ed5986367c62ff2098fa84d
parent4c1b0c2241bf72b2c66a73b3468e6698964e3f0a (diff)
Add a test for #3030
-rw-r--r--tests/source/match.rs15
-rw-r--r--tests/target/match.rs12
2 files changed, 27 insertions, 0 deletions
diff --git a/tests/source/match.rs b/tests/source/match.rs
index db73570dbdf..1643449773e 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::<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("+")
+            )
+            => {
+            }
+    }
+}
diff --git a/tests/target/match.rs b/tests/target/match.rs
index daa1f9f65db..130c9adfb3d 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::<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("+")
+            ) => {}
+    }
+}