Fork me on GitHub
#testing
<
2021-12-17
>
lassemaatta15:12:27

does anyone happen to know any good (testing) libraries for asserting facts about deeply nested structures in a "fuzzy" way?

lassemaatta15:12:50

For example expectations offers simple checks like (expect {:foo 1} (in {:foo 1 :cat 4})), what I'm looking for is similar but with deeply nested data structures where some parts need to match exactly while others should a) accept extra elements, and/or b) ignore the order of elements

mpenet15:12:57

meander could be a good fit

lassemaatta16:12:15

an interesting suggestion, thanks

lassemaatta17:12:51

That looks quite promising, thanks

mauricio.szabo20:12:27

👍 for matcher-combinators - that's what I use at my library check. Just be aware that some checks are harder, and it can slow down or even lock up your tests if you structure is too big (but it's incredibly rare in the real world - I only had 1 case where this posed an issue)

lassemaatta06:12:41

question about nubank/matcher-combinators: the library seems quite nice, but I'm having trouble getting the output look correct. To be precise: both emacs/cider and cursive seem to have trouble rendering the ANSI escape codes and instead show the raw escape sequence, e.g. [31m:a[0m instead of :a (in red). It works fine from the command line (e.g. lein test).

lassemaatta07:12:48

(I can circumvent this with a test fixture where I bind matcher-combinators.ansi-color/*use-color* to false, but this seems tedious just to get the output readable)