diff options
author | Alex Tokarev <aleksator@gmail.com> | 2020-10-11 20:30:55 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-11 12:30:55 -0500 |
commit | c74293f7a87cea3ce60a4df1c905501d4b749067 (patch) | |
tree | 60b020ad5cd7ce36bcd90e6660b8ba2a6a3b0d45 /test-suite/tests | |
parent | 940fcf9e183ab4f29204ef4f3ea92c01de8cc08a (diff) | |
download | milf-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')
-rw-r--r-- | test-suite/tests/datetime.rs | 6 | ||||
-rw-r--r-- | test-suite/tests/invalid.rs | 4 | ||||
-rw-r--r-- | test-suite/tests/parser.rs | 19 |
3 files changed, 19 insertions, 10 deletions
diff --git a/test-suite/tests/datetime.rs b/test-suite/tests/datetime.rs index 74b5939..6c08748 100644 --- a/test-suite/tests/datetime.rs +++ b/test-suite/tests/datetime.rs @@ -68,15 +68,15 @@ fn bad_times() { ); bad!( "foo = T", - "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 = T.", - "expected newline, found a period at line 1 column 8" + "invalid TOML value, did you mean to use a quoted string? at line 1 column 7" ); bad!( "foo = TZ", - "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 = 1997-09-09T09:09:09.09+", diff --git a/test-suite/tests/invalid.rs b/test-suite/tests/invalid.rs index ccc9338..f04d860 100644 --- a/test-suite/tests/invalid.rs +++ b/test-suite/tests/invalid.rs @@ -197,7 +197,7 @@ test!( test!( text_after_array_entries, include_str!("invalid/text-after-array-entries.toml"), - "invalid number at line 2 column 46" + "invalid TOML value, did you mean to use a quoted string? at line 2 column 46" ); test!( text_after_integer, @@ -222,5 +222,5 @@ test!( test!( text_in_array, include_str!("invalid/text-in-array.toml"), - "invalid number at line 3 column 3" + "invalid TOML value, did you mean to use a quoted string? at line 3 column 3" ); 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] |