aboutsummaryrefslogtreecommitdiff
path: root/test-suite
diff options
context:
space:
mode:
authorEric Huss <eric@huss.org>2019-08-23 09:55:15 -0700
committerAlex Crichton <alex@alexcrichton.com>2019-08-23 09:55:15 -0700
commit994b0e2fcb762bfbde2121a2baedd533d97a2475 (patch)
tree883a0088c07f3b2efa494a2348297f0b28f667ac /test-suite
parent4951dc400c1beda4cba25fe72d733a24758063f7 (diff)
downloadmilf-rs-994b0e2fcb762bfbde2121a2baedd533d97a2475.tar.gz
milf-rs-994b0e2fcb762bfbde2121a2baedd533d97a2475.zip
Allow zero-prefixed float exponents. (#322)
Diffstat (limited to 'test-suite')
-rw-r--r--test-suite/tests/parser.rs1
-rw-r--r--test-suite/tests/valid.rs6
-rw-r--r--test-suite/tests/valid/float-exponent.json11
-rw-r--r--test-suite/tests/valid/float-exponent.toml9
4 files changed, 26 insertions, 1 deletions
diff --git a/test-suite/tests/parser.rs b/test-suite/tests/parser.rs
index 012bd65..eab9f5a 100644
--- a/test-suite/tests/parser.rs
+++ b/test-suite/tests/parser.rs
@@ -270,7 +270,6 @@ fn bad_floats() {
bad!("a = 0.0e", "invalid number at line 1 column 5");
bad!("a = 0.0e-", "invalid number at line 1 column 9");
bad!("a = 0.0e+", "invalid number at line 1 column 5");
- bad!("a = 0.0e+00", "invalid number at line 1 column 11");
}
#[test]
diff --git a/test-suite/tests/valid.rs b/test-suite/tests/valid.rs
index 6914edd..e080958 100644
--- a/test-suite/tests/valid.rs
+++ b/test-suite/tests/valid.rs
@@ -368,3 +368,9 @@ test!(
include_str!("valid/quote-surrounded-value.toml"),
include_str!("valid/quote-surrounded-value.json")
);
+
+test!(
+ float_exponent,
+ include_str!("valid/float-exponent.toml"),
+ include_str!("valid/float-exponent.json")
+);
diff --git a/test-suite/tests/valid/float-exponent.json b/test-suite/tests/valid/float-exponent.json
new file mode 100644
index 0000000..97709b4
--- /dev/null
+++ b/test-suite/tests/valid/float-exponent.json
@@ -0,0 +1,11 @@
+{
+ "lower": {"type": "float", "value": "300.0"},
+ "upper": {"type": "float", "value": "300.0"},
+ "neg": {"type": "float", "value": "0.03"},
+ "pos": {"type": "float", "value": "300.0"},
+ "zero": {"type": "float", "value": "3.0"},
+ "pointlower": {"type": "float", "value": "310.0"},
+ "pointupper": {"type": "float", "value": "310.0"},
+ "prefix-zero-exp": {"type": "float", "value": "1000000.0"},
+ "prefix-zero-exp-plus": {"type": "float", "value": "1000000.0"}
+}
diff --git a/test-suite/tests/valid/float-exponent.toml b/test-suite/tests/valid/float-exponent.toml
new file mode 100644
index 0000000..5349db3
--- /dev/null
+++ b/test-suite/tests/valid/float-exponent.toml
@@ -0,0 +1,9 @@
+lower = 3e2
+upper = 3E2
+neg = 3e-2
+pos = 3E+2
+zero = 3e0
+pointlower = 3.1e2
+pointupper = 3.1E2
+prefix-zero-exp = 1e06
+prefix-zero-exp-plus = 1e+06