about summary refs log tree commit diff
path: root/src/libcore/tests
diff options
context:
space:
mode:
authorvarkor <github@varkor.com>2018-02-15 15:54:40 +0000
committervarkor <github@varkor.com>2018-02-19 14:53:30 +0000
commitc0e87f13a4d2f6fcef92c8c01bdc8dda9e0549a5 (patch)
tree6ac9068dc63b83245c96964544f942bc8238eddb /src/libcore/tests
parent90759befe0234b20ecf81edbbff353b85419d7e9 (diff)
downloadrust-c0e87f13a4d2f6fcef92c8c01bdc8dda9e0549a5.tar.gz
rust-c0e87f13a4d2f6fcef92c8c01bdc8dda9e0549a5.zip
Make ".e0" not parse as 0.0
This forces floats to have either a digit before the separating point, or after. Thus ".e0" is invalid like ".", when using `parse()`.
Diffstat (limited to 'src/libcore/tests')
-rw-r--r--src/libcore/tests/num/dec2flt/mod.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libcore/tests/num/dec2flt/mod.rs b/src/libcore/tests/num/dec2flt/mod.rs
index 9934e1dab96..17b2f59cd4d 100644
--- a/src/libcore/tests/num/dec2flt/mod.rs
+++ b/src/libcore/tests/num/dec2flt/mod.rs
@@ -102,6 +102,12 @@ fn lonely_dot() {
 }
 
 #[test]
+fn exponentiated_dot() {
+    assert!(".e0".parse::<f32>().is_err());
+    assert!(".e0".parse::<f64>().is_err());
+}
+
+#[test]
 fn lonely_sign() {
     assert!("+".parse::<f32>().is_err());
     assert!("-".parse::<f64>().is_err());