aboutsummaryrefslogtreecommitdiff
path: root/tests/pretty.rs
blob: 6758cfb2c9e4f00522014000f3775a381f68fa66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
extern crate toml;
extern crate serde;

use serde::ser::Serialize;

const EXAMPLE: &str = "\
[example]
text = '''
this is the first line
this is the second line
'''
";

#[test]
fn test_pretty() {
    let value: toml::Value = toml::from_str(EXAMPLE).unwrap();
    let mut result = String::with_capacity(128);
    value.serialize(&mut toml::Serializer::pretty(&mut result)).unwrap();
    assert_eq!(EXAMPLE, &result);
}