diff options
author | rhysd <lin90162@yahoo.co.jp> | 2018-09-25 16:33:52 +0900 |
---|---|---|
committer | rhysd <lin90162@yahoo.co.jp> | 2018-09-25 16:33:52 +0900 |
commit | 2f372b9f1079b866d633d6b5cecfaf573f3480f0 (patch) | |
tree | 52b7740ab46eaff37016b53a71f733dc6eba7908 /test-suite/tests | |
parent | 8181a7e645064426b43891b0f4c7fa86c2a2d154 (diff) | |
download | milf-rs-2f372b9f1079b866d633d6b5cecfaf573f3480f0.tar.gz milf-rs-2f372b9f1079b866d633d6b5cecfaf573f3480f0.zip |
Fix multi-line strings are not allowed for key
In spec https://github.com/toml-lang/toml#keys
Quoted keys are clarified as
> he exact same rules as either basic strings or literal strings
TOML clearly distinguishes basic string and multi-line basic string
(literal string is also).
https://github.com/toml-lang/toml#string
So table key and quoted key should not allow multi-line basic string
and multi-line literal string.
ABNF definition also describes that.
https://github.com/toml-lang/toml/blob/master/toml.abnf
```
string = ml-basic-string / basic-string / ml-literal-string / literal-string
quoted-key = basic-string / literal-string
```
`string` contains `ml-*` but `quoted-key` doesn't.
Diffstat (limited to 'test-suite/tests')
-rw-r--r-- | test-suite/tests/parser.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test-suite/tests/parser.rs b/test-suite/tests/parser.rs index 2282416..2534ce6 100644 --- a/test-suite/tests/parser.rs +++ b/test-suite/tests/parser.rs @@ -275,6 +275,10 @@ fn bad_keys() { "\"\"|=3".parse::<Value>().unwrap_err(); "\"\n\"|=3".parse::<Value>().unwrap_err(); "\"\r\"|=3".parse::<Value>().unwrap_err(); + "''''''=3".parse::<Value>().unwrap_err(); + "\"\"\"\"\"\"=3".parse::<Value>().unwrap_err(); + "'''key'''=3".parse::<Value>().unwrap_err(); + "\"\"\"key\"\"\"=3".parse::<Value>().unwrap_err(); } #[test] @@ -290,6 +294,8 @@ fn bad_table_names() { "[']".parse::<Value>().unwrap_err(); "[''']".parse::<Value>().unwrap_err(); "['''''']".parse::<Value>().unwrap_err(); + "['''foo''']".parse::<Value>().unwrap_err(); + "[\"\"\"bar\"\"\"]".parse::<Value>().unwrap_err(); "['\n']".parse::<Value>().unwrap_err(); "['\r\n']".parse::<Value>().unwrap_err(); } |