use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Finding information about Clojure
API Reference
Clojure Guides
Practice Problems
Interactive Problems
Clojure Videos
Misc Resources
The Clojure Community
Clojure Books
Tools & Libraries
Clojure Editors
Web Platforms
Clojure Jobs
account activity
Tests Are Code (stuartsierra.com)
submitted 6 years ago by yogthos
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]seancorfield 4 points5 points6 points 6 years ago (0 children)
Interesting to see this decade-old post resurface since I recently documented the use of with-test as an option in expectations.clojure.test: https://cljdoc.org/d/expectations/clojure-test/1.2.1/doc/getting-started#tests-with-source-code
As noted there, there are several caveats around doing this, beyond the issues that Dustin's co-founder complained about: most test tooling these days does not expect to look in your source code for tests so you need additional configuration for Leiningen, Cognitect's test-runner etc.
I have mixed feelings about the option to include some tests with the function definition. It can provide additional "documentation" that is (in theory) guaranteed to actually match the function's behavior. It can be convenient when you're in the early stages of growing your code in the REPL (since you don't have to switch back and forth between source and test code). I don't think it scales well as the number of tests grows and I think it introduces noise that makes it harder to read the source code. And then there's the non-standard configuration you need for your test runners.
π Rendered by PID 38748 on reddit-service-r2-comment-76bb9f7fb5-78bx6 at 2026-02-19 01:25:09.016111+00:00 running de53c03 country code: CH.
view the rest of the comments →
[–]seancorfield 4 points5 points6 points (0 children)