aboutsummaryrefslogtreecommitdiff
path: root/test-suite/tests
diff options
context:
space:
mode:
authorEric Huss <eric@huss.org>2019-08-13 14:51:03 -0700
committerGitHub <noreply@github.com>2019-08-13 14:51:03 -0700
commit801188700fbabf9bb0fea11b88e0720fadb8cd36 (patch)
tree7c401dc26a6cdb947a279fe964f72d06f275d5bb /test-suite/tests
parentd03b251af5f935ea8363ebc59f1caddf99feb790 (diff)
parentf4dd4a2438c0000846a6bfd21d8b18dc47f280cf (diff)
downloadmilf-rs-801188700fbabf9bb0fea11b88e0720fadb8cd36.tar.gz
milf-rs-801188700fbabf9bb0fea11b88e0720fadb8cd36.zip
Merge pull request #320 from ehuss/crlf-error-index
Fix error line/column when using CRLF line endings.
Diffstat (limited to 'test-suite/tests')
-rw-r--r--test-suite/tests/de-errors.rs27
1 files changed, 27 insertions, 0 deletions
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"
+ );
+
+}