Skip to content

Forms which macroexpand into deftest aren't recognised by cider-test-run-test #1776

Closed
@samroberton

Description

@samroberton

Expected behavior

cider-test-run-test should run the test at point, even if it is not directly declared in the Emacs buffer with deftest.

You might use a convenience macro which macroexpands into a deftest form as a means of following Stuart Sierra's advice to avoid clojure.test's fixtures mechanism, for example.

Actual behavior

"No test at point"

Steps to reproduce the problem

(ns fancy-test
  (:require [clojure.test :refer :all]))

(defn- do-setup []
  (println "Expensive resource setup"))

(defmacro deffancytest [sym & body]
  `(deftest ~sym
     (do-setup)
     ~@body))

(deffancytest fancytest
  (is (= 1 1)))

Invoke cider-test-run-test with the point in fancytest and you'll get "No test at point" in the minibuffer.

Environment & Version information

CIDER version information

;; CIDER 0.12.0 (Seattle), nREPL 0.2.12
;; Clojure 1.8.0, Java 1.8.0_40

Lein/Boot version

boot 2.5.5

Emacs version

24.4.1

Operating system

OS X 10.11

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions