Skip to content

Cannot run tests defined with custom macro #3279

@lmartelli

Description

@lmartelli

Expected behavior

Run tests, provided cider-test-defining-forms is customized for a custom test macro

Actual behavior

No assertions (or no tests) were run.Did you forget to use ‘is’ in your tests?

Steps to reproduce the problem

(ns test
  (:require
   [clojure.test :refer [deftest is are]]))


(defmacro def-my-test [f expected]
  `(deftest ~(symbol (str f "-test"))
     (is (= ~expected (~f)))))

(defn meaning-of-life [] 42)

(def-my-test meaning-of-life 43)

Include def-my-test in cider-test-defining-forms.

Run test for (def-my-test meaning-of-life 42) with `C-c C-

Macros sems to be OK, since I can run the test by hand :

test> (meaning-of-life-test)

FAIL in (meaning-of-life-test) (test.clj:12)
expected: (clojure.core/= 43 (meaning-of-life))
  actual: (not (clojure.core/= 43 42))
nil

Environment & Version information

CIDER version information

Include here the version string displayed when
CIDER's REPL is launched. Here's an example:

;; CIDER 1.1.1 (Plovdiv), nREPL 0.8.3
;; Clojure 1.10.0, Java 17.0.5

Lein / Clojure CLI version

Leiningen 2.9.1

Emacs version

27.1

Operating system

Ubuntu 22.04.1 LTS
Linux tp 5.15.0-56-generic #62-Ubuntu SMP

JDK distribution

openjdk version "17.0.5" 2022-10-18
OpenJDK Runtime Environment (build 17.0.5+8-Ubuntu-2ubuntu122.04)
OpenJDK 64-Bit Server VM (build 17.0.5+8-Ubuntu-2ubuntu122.04, mixed mode, sharing)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions