mwanji / toml4j

A Java TOML parser
MIT License
324 stars 57 forks source link

No Spacing between Map-Entries #66

Open MaZderMind opened 4 years ago

MaZderMind commented 4 years ago

When Writing Maps with Map-Values, the Writer does not add newlines between the Entries.

Given the following Map:

    HashMap<String, Object> items = new HashMap();

    HashMap<String, Object> item1 = new HashMap();
    item1.put("id", "1");
    item1.put("display", "Foo");

    HashMap<String, Object> item2 = new HashMap();
    item2.put("id", "2");
    item2.put("display", "Bar");

    HashMap<String, Object> item3 = new HashMap();
    item3.put("id", "3");
    item3.put("display", "Moo");

    items.put("foo", item1);
    items.put("bar", item2);
    items.put("moo", item3);

the expected Output would be

[bar]
display = "Bar"
id = "2"

[foo]
display = "Foo"
id = "1"

[moo]
display = "Moo"
id = "3"

while it actually is

[bar]
display = "Bar"
id = "2"
[foo]
display = "Foo"
id = "1"
[moo]
display = "Moo"
id = "3"
MaZderMind commented 4 years ago

For a complete reproduction test-case and the fix, see #67