tingerrr / typst-test

A test runner for typst projects.
https://tingerrr.github.io/typst-test/
MIT License
27 stars 2 forks source link

Introspection tests #23

Open tingerrr opened 5 months ago

tingerrr commented 5 months ago

Add tests which, in some way or form, assert that parts of the introspection between test and reference matches. This would only be allowed on ephemeral tests, as we need introspection information for both documents.

See https://github.com/tingerrr/typst-test/issues/14#issuecomment-2177634583.

freundTech commented 5 months ago

Couldn't you just compare the values using assert.eq? [...] I don't see a specific reason for query, at least for this example, but I'll make an issue for it.

I guess the main advantage would be nicer output. assert.eq prints both sides fully, when the values are not equal. pytest, which I used in my example only prints the relevant parts. For example when both sides are dictionaries it only prints the keys which differed.

I guess all of that would also be possible to implement either inside typst or as a typst package though.

tingerrr commented 5 months ago

I guess the main advantage would be nicer output. assert.eq prints both sides fully, when the values are not equal. pytest, which I used in my example only prints the relevant parts. For example when both sides are dictionaries it only prints the keys which differed.

That's something I can add to the augmented standard test library typst-test will offer after the rewrite, but it's true that this could be implemented as a package too.