Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I wanted some tests to check that images were being included exactly as before for #68. So I added snapshot testing with
insta
, which is much simpler to set up and see differences with than the existingtex-outputs
testing which can only report binary failure.Old procedure was apparently (I couldn't find docs for it) to compile a .tex file separately with tectonic with a bunch of flags to dump logs, do it again with
--format xdv
, then separate assets into the assets folder, and if you wanted to change it, you had to put all those files together again...Procedure to add a test case now:
.tex
file totests/snapshots
.mod snapshots
undertests/tex-outputs.rs
, using TestCase like the others, but executing it with.snap()
instead of.go()
.cargo test --test tex-outputs snapshots
.cargo insta review
after you've installedcargo-insta
.Read https://docs.rs/insta/ for more details on use, especially using
INSTA_FORCE_PASS=1
to avoid bailing at the first sign of snapshot failure & ensure all.snap.new
files are written, which is especially relevant as there will often be more than one failure within a test case when checking multiple passes of the output.Some notes and questions:
insta
doesn't have anything suitable for binary files out of the box, but this seems to work well enough.test_name.preview.pdf
in the snapshots directory, which you can visually check. These are gitignored..snap
code is not exactly DRY with.go()
but I don't think it matters too much..tex
files in the same directory as the.snap
files -- is that going to be annoying?