tingerrr / typst-test

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

Structural diffing of Typst values #25

Open tingerrr opened 3 months ago

tingerrr commented 3 months ago

Add functions which do structural diffing on their input values, showing only the mismatched portion.

#assert-strural-eq(
  (a: 1, b: 2, c: 3),
  (a: 1, b: 3, d: 3),
)

Which would only highlight the value difference in b and the key difference in c/d. See https://github.com/tingerrr/typst-test/issues/23#issuecomment-2191498924.

In some sense, this is already kind of possible by using the valkyrie package and creating schema on the fly from one of the values, but this is biased towards one value.

cc: @JamesXx you may be interested in this.

jamesrswift commented 3 months ago

Beautiful, I'm gonna see about updating the tests