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

Support for files with (or without) diffing #190

Closed
bjchambers opened this issue Aug 11, 2021 · 4 comments
Closed

Support for files with (or without) diffing #190

bjchambers opened this issue Aug 11, 2021 · 4 comments

Comments

@bjchambers
Copy link

It would be helpful if insta could also be used for managing file contents. For instance, some tests may produce CSV (and the plain text / diffing based on strings i great), but if other tests want to produce Parquet files (a binary format) they can't use insta.

How difficult would it be to have something like insta::assert_binary_file(<path>) and insta::assert_text_file(<path>)?

@mitsuhiko
Copy link
Owner

What would the behavior of this be when the mismatch happens?

@bjchambers
Copy link
Author

It could be similar to https://docs.rs/goldenfile/1.1.0/goldenfile/ - output the diff (or diff hashes if the files are binary) and allow accepting to overwrite the expected file (or hash).

@mitsuhiko
Copy link
Owner

I would be accepting a patch for it but I assume the work required would be quite significant since everything in the system currently assumes unicode strings.

@mitsuhiko
Copy link
Owner

Closing this as duplicate of #196

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants