Expect magic in ppxlib tests

How does this magic in ppxlib tests work?

How does the AST resulting from %stri, etc. make it to stdout?

Better yet, how does the loc declaration at line 1 make it to stdout?

It’s not using the typical ppx_expect based on printing, but a custom expect test program that lives at ppxlib/test/expect/expect_test.ml at main · ocaml-ppx/ppxlib · GitHub