Skip to content

Emitter styling settings overridden by node settings. #298

@Ortham

Description

@Ortham

The following test passes in 9880b60 but fails in the next commit, 0c28072.

TEST_F(EmitterTest, GlobalSettingsNodeStyles) {
    Node node = Load("foo:\n"
                "  - 1\n"
                "  - 2\n"
                "  - 3\n"
                "bar: baz\n");

    out.SetSeqFormat(YAML::Flow);
    out.SetMapFormat(YAML::Flow);

    out << node;

    ExpectEmit("{foo: [1, 2, 3], bar: baz}");
}

The failing actual value is foo:\n - 1\n - 2\n - 3\nbar: baz. I'd expect setting formatting on the emitter to override any preserved styling from when the node was parsed.

Commenting out the two node.set_style(style); lines added to src/nodebuilder.cpp in the latter commit prevents the issue occurring, but it's not really a fix...

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions