Posts

Showing posts from January, 2016

Clojure ‘def’, ‘declare’, and ‘concat’

I hit the Aeron hard and asked my pair Liz “what’s up?” I’d been sick and she had been working on a tricky Datomic datalog query in my absence. She claimed to have solved the whole problem but the tests would not pass when run as a whole vs. when run individually. A classic problem with a big Clojure twist. I, being no stranger to this terribleness, eventually shook the sick out of my head and asked if she had tried running the singular test file by itself. Good news: it failed too.  What? I’ll explain.  We use a classic trick here at Backstop when running tests in the Clojure REPL: ‘:reload-all’ (require '[clojure.test :refer [run-tests]]) (require 'your-ns.example-test) (run-tests ‘your-ns.example-test) ; First time (require 'your-ns.example-test :reload-all) ; Picks up new changes in the files (run-tests ‘your-ns.example-test) Otherwise we’d spend all day waiting for the JVM to start up every time we run our tests. It’s a cool trick but it has its lim