From f4dd4a2438c0000846a6bfd21d8b18dc47f280cf Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Tue, 13 Aug 2019 13:48:54 -0700 Subject: Fix error line/column when using CRLF line endings. --- test-suite/tests/de-errors.rs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'test-suite/tests') diff --git a/test-suite/tests/de-errors.rs b/test-suite/tests/de-errors.rs index 7cceb7b..5005313 100644 --- a/test-suite/tests/de-errors.rs +++ b/test-suite/tests/de-errors.rs @@ -323,3 +323,30 @@ fn serde_derive_deserialize_errors() { "invalid type: integer `1`, expected a string for key `p_b` at line 4 column 34" ); } + +#[test] +fn error_handles_crlf() { + bad!( + "\r\n\ + [t1]\r\n\ + [t2]\r\n\ + a = 1\r\n\ + a = 2\r\n\ + ", + toml::Value, + "duplicate key: `a` for key `t2` at line 3 column 1" + ); + + // Should be the same as above. + bad!( + "\n\ + [t1]\n\ + [t2]\n\ + a = 1\n\ + a = 2\n\ + ", + toml::Value, + "duplicate key: `a` for key `t2` at line 3 column 1" + ); + +} -- cgit v1.2.3