[HN Gopher] Writing your Clojure tests in EDN files
___________________________________________________________________
Writing your Clojure tests in EDN files
Author : jacobobryant
Score : 59 points
Date : 2025-07-19 15:36 UTC (2 days ago)
(HTM) web link (biffweb.com)
(TXT) w3m dump (biffweb.com)
| andersmurphy wrote:
| Nice! Thanks for sharing. The expectation part reminds me of this
| jane street post [1].
|
| - [1] https://blog.janestreet.com/the-joy-of-expect-tests/
| jacobobryant wrote:
| Agreed, thanks for sharing that post. Good read.
| erichocean wrote:
| There's a version of this for testing SQL database:
|
| You have a .sql file that contains the query and then the
| response is next AS SQL COMMENTS. The test runner runs the query
| and verifies that it matches the (comment-delimiter stripped)
| comment immediately following the query.
|
| Your .sql can contain database creation, inserts, you name it.
|
| Then you run them as part of your CI infrastructure.
| lyxell wrote:
| I like to use txtar files for snapshot testing. I let one of the
| file fields contain the expected output and one or more contain
| the input(s). Most mainstream languages already have txtar
| parsers so this approach makes it trivial to port an entire test
| suite across languages.
|
| See https://docs.rs/txtar/latest/txtar/ for an example
___________________________________________________________________
(page generated 2025-07-21 23:01 UTC)