Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Structured data (like json, ndjson, toml, yaml) asserts in snapbox #92

Open
2 of 3 tasks
epage opened this issue Apr 22, 2022 · 3 comments
Open
2 of 3 tasks

Structured data (like json, ndjson, toml, yaml) asserts in snapbox #92

epage opened this issue Apr 22, 2022 · 3 comments
Labels
A-snapbox Area: snapbox package enhancement Improve the expected

Comments

@epage
Copy link
Contributor

epage commented Apr 22, 2022

Like the value from special handling of text vs binary, asserting with knowledge of structured data would help gloss over irrelevant details and allow smarter wildcards

@epage epage added the enhancement Improve the expected label Apr 22, 2022
@epage
Copy link
Contributor Author

epage commented Apr 22, 2022

A basic way of doing this is

  • Have feature flags per file format
  • Have path asserts check for file type and deserialize the file according to any enabled formats
  • For matches, instead of equality, create structured wildcards (wildcards that match entire subsets of the data). See cargo-test-support for ideas

@epage
Copy link
Contributor Author

epage commented Apr 22, 2022

Besides a {..}, should we have {VAR}s that we deserialize and substitute?

@Muscraft
Copy link
Collaborator

Muscraft commented Jul 18, 2022

After some discussion with @epage, we found the following blockers:

@epage epage changed the title Structured data (like json, toml, yaml) asserts in snapbox Structured data (like json, ndjson, toml, yaml) asserts in snapbox Sep 2, 2022
@settings settings bot removed the A-snapbox label Aug 14, 2023
@epage epage added the A-snapbox Area: snapbox package label Aug 15, 2023
epage added a commit to epage/snapbox that referenced this issue Apr 19, 2024
Looks like ndjson was merged into jsonlines, so went with that.

One difference at one point was allowing blank lines from what I've
heard.  I'm not seeing it mentioned in jsonlines but went with
supporting it.

Part of assert-rs#92
epage added a commit to epage/snapbox that referenced this issue May 23, 2024
Looks like ndjson was merged into jsonlines, so went with that.

One difference at one point was allowing blank lines from what I've
heard.  I'm not seeing it mentioned in jsonlines but went with
supporting it.

Part of assert-rs#92

Cherry pick ae6bce4 (assert-rs#277)
Cherry pick 62ddc26 (assert-rs#290)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-snapbox Area: snapbox package enhancement Improve the expected
Projects
None yet
Development

No branches or pull requests

2 participants