aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGarrett Berg <vitiral@gmail.com>2017-07-09 14:58:48 -0600
committerGarrett Berg <vitiral@gmail.com>2017-07-09 14:58:48 -0600
commit391cb61dffd51322bd310be7cba8641fe3398c19 (patch)
tree2c198e0504159af8f2cbe7cdb123e9f69bfb5122 /tests
parent3c5a9486cb84c0076ee12b7d40372f819a54ac05 (diff)
downloadmilf-rs-391cb61dffd51322bd310be7cba8641fe3398c19.tar.gz
milf-rs-391cb61dffd51322bd310be7cba8641fe3398c19.zip
add pretty sting serialization
Diffstat (limited to 'tests')
-rw-r--r--tests/pretty.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/pretty.rs b/tests/pretty.rs
new file mode 100644
index 0000000..71c9e63
--- /dev/null
+++ b/tests/pretty.rs
@@ -0,0 +1,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);
+}