parse_back

Function parse_back 

Source
pub fn parse_back(map: &[IndexMap<String, Item>]) -> String
Expand description

Parse back:

use indexmap::IndexMap;
use eight_deep_parser::{parse_back, Item};
 
fn test_parse_back() {
    let mut map = vec![];

    let mut item1 = IndexMap::new();
    item1.insert("a".to_string(), Item::OneLine("b".to_string()));
    item1.insert(
        "c".to_string(),
        Item::MultiLine(vec!["a".to_string(), "b".to_string()]),
    );
    item1.insert("d".to_string(), Item::OneLine("e".to_string()));
    map.push(item1);

    let mut item2 = IndexMap::new();
    item2.insert("a".to_string(), Item::OneLine("b".to_string()));
    map.push(item2);

    let s = parse_back(&map);

    assert_eq!(
        s,
        r#"a: b
c:
  a
  b
d: e

a: b

"#
    )
}