I’ve used these sorts of tests before, but under the name of ‘golden’ rather than ‘expect tests’. To complement the post’s OCaml example, here’s an article on how to use them in Haskell: https://ro-che.info/articles/2017-12-04-golden-tests
Yeah, the term "golden" is common in the hardware world, which corresponds to expected signal level traces either captured from a physical device with a logic analyzer, or generated with an ideal model.