Questions tagged [clojure.test]

Unit test framework for clojure.

Clojure.test API is a unit test framework.

23 questions
0
votes
2 answers

What do round brackets mean in the output of clojure.test failures?

I have the following output in one of my tests: Assertion failed: Expected :[[] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] ["seq07"] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []…
Glory to Russia
  • 17,289
  • 56
  • 182
  • 325
0
votes
1 answer

Can't get test to true when the result is a function (Syntax error compiling at .... No such var:...)

Happens when I want to test a function where the result is another function. I have something like this: ns flexsearch.core (defn init [{:keys [tokenizer split indexer filter] :as options}] (let [encoder (get-encoder (:encoder options))] …
0
votes
2 answers

Is there an (idiomatic) way of testing the result of an IO function in Clojure?

I have a function that saves some text to a file: (defn save-keypair "saves keypair to ~/.ssb-clj/secret" [pair file-path] (let [public-key-string (->> (:public pair) (.array) (byte-array) (b64/encode) (bs/to-string)) secret-key-string…
TomLisankie
  • 3,785
  • 7
  • 28
  • 32
0
votes
2 answers

unable to remove duplication when composing tests

I am unable to remove duplication inside a clojure.test test. Suppose I have multiple implementations for the same abstraction: (defn foo1 [] ,,,) (defn foo2 [] ,,,) (defn foo3 [] ,,,) and I also have a test that all implementations should…
beluchin
  • 12,047
  • 4
  • 24
  • 35
0
votes
1 answer

Test sequence of sample data generated from clojure.spec

Context I have a function that operates on a data structure. I have written a spec for the data structure this function operates on. This function returns a reagent component that is rendered in a browser (PhantomJS) The spec has some optional…
rdgd
  • 1,451
  • 2
  • 18
  • 33
0
votes
0 answers

boot-clj: how to build/launch unit test for class generated with gen-class

In my clojure project I built several java classes using gen-class command. They are [extractor.yaml YAMLExtractor YAMLExtractorFactory]. I wanted now build unit test against those classes but I have error: java.lang.ClassNotFoundException:…
Jacek
  • 11
  • 4
0
votes
1 answer

In clojure test, how to mock out multiple methods when testing one function?

I am writing a clojure.test unit test for a rather large function in my application. This function makes several calls to db and external REST services and does some computation. for example, my function to be tested is like so (defn myfunc [id] …
user193116
  • 3,498
  • 6
  • 39
  • 58
0
votes
1 answer

Is there a way to have fixtures that are specific to a certain tests and not all in the given namespace?

just like midje lets us wrap facts in a with-state-changes form to specify what should run specifically before, around or after them or the content, how does one accomplish the same with clojure.test
Amogh Talpallikar
  • 12,084
  • 13
  • 79
  • 135
1
2