Skip to content

Easier to diff, prettier rendering for jsonlines #348

@epage

Description

@epage

cargo-test-supports built-in assertions for jsonlines would perform the following transformation to the "expected" value

    let expected_objs: Vec<_> = expected
        .split("\n\n")
        .map(|expect| {
            expect
                .parse()
                .with_context(|| format!("failed to parse expected JSON object:\n{}", expect))
        })
        .collect::<Result<_>>()?;

so instead of

{}
{}

you'd get

{
}

{
}

This makes it easier to inspect the jsonlines data and to view the diffs.

For Cargo to adopt snapbox, we need something similar, see rust-lang/cargo#14039

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-snapboxArea: snapbox packageenhancementImprove the expected

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions