aboutsummaryrefslogtreecommitdiff
path: root/test-suite/tests/parser.rs
diff options
context:
space:
mode:
authorAlex Tokarev <aleksator@gmail.com>2020-10-11 20:30:55 +0300
committerGitHub <noreply@github.com>2020-10-11 12:30:55 -0500
commitc74293f7a87cea3ce60a4df1c905501d4b749067 (patch)
tree60b020ad5cd7ce36bcd90e6660b8ba2a6a3b0d45 /test-suite/tests/parser.rs
parent940fcf9e183ab4f29204ef4f3ea92c01de8cc08a (diff)
downloadmilf-rs-c74293f7a87cea3ce60a4df1c905501d4b749067.tar.gz
milf-rs-c74293f7a87cea3ce60a4df1c905501d4b749067.zip
Improve error message when parsing unquoted string (#385)
* Improve error message when parsing unquoted string * Remove conversion to lowercase in parse_keylike() Converting keys to lowercase goes against TOML specification for floats. * Change error message for unquoted string
Diffstat (limited to 'test-suite/tests/parser.rs')
-rw-r--r--test-suite/tests/parser.rs19
1 files changed, 14 insertions, 5 deletions
diff --git a/test-suite/tests/parser.rs b/test-suite/tests/parser.rs
index eab9f5a..169df79 100644
--- a/test-suite/tests/parser.rs
+++ b/test-suite/tests/parser.rs
@@ -491,7 +491,10 @@ fn number_underscores() {
fn bad_underscores() {
bad!("foo = 0_", "invalid number at line 1 column 7");
bad!("foo = 0__0", "invalid number at line 1 column 7");
- bad!("foo = __0", "invalid number at line 1 column 7");
+ bad!(
+ "foo = __0",
+ "invalid TOML value, did you mean to use a quoted string? at line 1 column 7"
+ );
bad!("foo = 1_0_", "invalid number at line 1 column 7");
}
@@ -537,14 +540,20 @@ fn booleans() {
bad!(
"foo = true2",
- "failed to parse datetime for key `foo` at line 1 column 7"
+ "invalid TOML value, did you mean to use a quoted string? at line 1 column 7"
+ );
+ bad!(
+ "foo = false2",
+ "invalid TOML value, did you mean to use a quoted string? at line 1 column 7"
);
- bad!("foo = false2", "invalid number at line 1 column 7");
bad!(
"foo = t1",
- "failed to parse datetime for key `foo` at line 1 column 7"
+ "invalid TOML value, did you mean to use a quoted string? at line 1 column 7"
+ );
+ bad!(
+ "foo = f2",
+ "invalid TOML value, did you mean to use a quoted string? at line 1 column 7"
);
- bad!("foo = f2", "invalid number at line 1 column 7");
}
#[test]