Welcome! Please see the About page for a little more info on how this works.

0 votes
in ClojureScript by
cljs.core/test doesn't take a Var, which makes it inconsistent with Clojure:

Clojure: `(test #'foo)`
Actual CLJS: `(test foo)`
Expected CLJS: `(test #'foo)`

Clojure example:

```
$ clj
Clojure 1.9.0
user=> (defn ^{:test #(assert false)} foo [] nil)
#'user/foo
user=> (test #'foo)
AssertionError Assert failed: false  user/fn--145 (NO_SOURCE_FILE:1)
```

CLJS example:

```
$ clj -m cljs.main -r
ClojureScript 1.10.439
cljs.user=> (defn ^{:test #(assert false)} foo [] nil)
#'cljs.user/foo
cljs.user=> (test #'foo)
:no-test

cljs.user=> (test foo)
Error: Assert failed: false

cljs.user=> ((:test (meta #'foo)))
Error: Assert failed: false
```

3 Answers

0 votes
by

Comment made by: shaunlebron

tested this patch. produces the expected result

0 votes
by

Comment made by: dnolen

I'm pretty sure this patch has to be more conservative. Only call meta if you have IMeta, otherwise fall back to the old behavior.

0 votes
by
Reference: https://clojure.atlassian.net/browse/CLJS-2978 (reported by shaunlebron)
...