unit-testingclojureclojure.test

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"] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []]
Actual   :[() () () () () () () () () () () () () () () () () () () () () () () () () () ("seq07") () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () () ()]

What do () and ("seq07") mean in this output?


Solution

  • () is a notation for list whereas [] is a notation for vectors

    () is an empty list and ("seq07") is a list that contains a single member - the string seq07

    you can read more about clojure lists here

    EDIT: just found this interesting SO question about lists vs vectors