aboutsummaryrefslogtreecommitdiff
path: root/tests/backcompat.rs
blob: 1b3f5993d0547fada260be8c189a607a4ab84300 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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));
}