summaryrefslogtreecommitdiffstats
path: root/third_party/rust/toml/tests/backcompat.rs
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/rust/toml/tests/backcompat.rs')
-rw-r--r--third_party/rust/toml/tests/backcompat.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/third_party/rust/toml/tests/backcompat.rs b/third_party/rust/toml/tests/backcompat.rs
new file mode 100644
index 0000000000..1b3f5993d0
--- /dev/null
+++ b/third_party/rust/toml/tests/backcompat.rs
@@ -0,0 +1,19 @@
+extern crate toml;
+extern crate serde;
+
+use serde::de::Deserialize;
+
+#[test]
+fn main() {
+ let s = "
+ [a] foo = 1
+ [[b]] foo = 1
+ ";
+ assert!(s.parse::<toml::Value>().is_err());
+
+ let mut d = toml::de::Deserializer::new(s);
+ d.set_require_newline_after_table(false);
+ let value = toml::Value::deserialize(&mut d).unwrap();
+ assert_eq!(value["a"]["foo"].as_integer(), Some(1));
+ assert_eq!(value["b"][0]["foo"].as_integer(), Some(1));
+}