aboutsummaryrefslogtreecommitdiff
path: root/test-suite/tests/backcompat.rs
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2019-07-29 09:06:35 -0500
committerGitHub <noreply@github.com>2019-07-29 09:06:35 -0500
commit5c6c3750727515fa4fc5bc3bc653293f5293f2c6 (patch)
treea043f6de866915df978bf7c166b7261b3c5d6335 /test-suite/tests/backcompat.rs
parent844a1a4651d6b77a5b48159348d9cccbd8f4c88f (diff)
parent3d08775266eb1979956b03add38e6bd4824f521a (diff)
downloadmilf-rs-5c6c3750727515fa4fc5bc3bc653293f5293f2c6.tar.gz
milf-rs-5c6c3750727515fa4fc5bc3bc653293f5293f2c6.zip
Merge pull request #313 from zertosh/show-col-in-errors
Show "column" in Error messages
Diffstat (limited to 'test-suite/tests/backcompat.rs')
-rw-r--r--test-suite/tests/backcompat.rs19
1 files changed, 17 insertions, 2 deletions
diff --git a/test-suite/tests/backcompat.rs b/test-suite/tests/backcompat.rs
index 53cda69..ef3bd36 100644
--- a/test-suite/tests/backcompat.rs
+++ b/test-suite/tests/backcompat.rs
@@ -3,13 +3,25 @@ extern crate toml;
use serde::de::Deserialize;
+macro_rules! bad {
+ ($toml:expr, $msg:expr) => {
+ match $toml.parse::<toml::Value>() {
+ Ok(s) => panic!("parsed to: {:#?}", s),
+ Err(e) => assert_eq!(e.to_string(), $msg),
+ }
+ };
+}
+
#[test]
fn newlines_after_tables() {
let s = "
[a] foo = 1
[[b]] foo = 1
";
- assert!(s.parse::<toml::Value>().is_err());
+ bad!(
+ s,
+ "expected newline, found an identifier at line 2 column 13"
+ );
let mut d = toml::de::Deserializer::new(s);
d.set_require_newline_after_table(false);
@@ -30,7 +42,10 @@ fn allow_duplicate_after_longer() {
[dependencies]
bitflags = 1
";
- assert!(s.parse::<toml::Value>().is_err());
+ bad!(
+ s,
+ "redefinition of table `dependencies` for key `dependencies` at line 8 column 9"
+ );
let mut d = toml::de::Deserializer::new(s);
d.set_allow_duplicate_after_longer_table(true);