Midje
Midje copied to clipboard
`tabular` + `fact` interaction can create invalid var names
Hi! I found the following issue.
We can observe that Midje emits delicate-looking var names:
matcher-combinators.core-test> (tabular (fact "Foo") ?matcher prefix embeds)
;; the whole thing below is a var object!
#'matcher-combinators.core-test/#:midje{:source (quote (tabular (fact "Foo") ?matcher prefix embeds)), :guid "5ff8c9530e9cdb7f77c312813c66f4aca8cbb9ab"}354442
Which becomes problematic when running more substantial code:
matcher-combinators.core-test> (tabular
(fact "Providing seq/map matcher with incorrect input leads to automatic mismatch"
(core/match (?matcher 1) 1)
=> (just {::result/type :mismatch
::result/value (sweet/contains {:expected-type-msg
#(str/starts-with? % (-> ?matcher var meta :name str))
:provided
"provided: 1"})
::result/weight number?}))
?matcher
prefix
embeds)
Syntax error macroexpanding clojure.core/defn at (*cider-repl 127.0.0.1*:1:32).
#:midje{:source (quote (tabular (fact "Providing seq/map matcher with incorrect input leads to automatic mismatch" (core/match (?matcher 1) 1) => (just #:matcher-combinators.result{:type :mismatch, :value (sweet/contains {:expected-type-msg (fn* [p1__354461#] (str/starts-with? p1__354461# (-> ?matcher var meta :name str))), :provided "provided: 1"}), :weight number?})) ?matcher prefix embeds)), :guid "171e8922a091d677c0175735d17f1a1dffb6df1a"}354464 - failed: simple-symbol? at: [:fn-name] spec: :clojure.core.specs.alpha/defn-args
Could you please look into emitting more var names having a less risky character set?
Thanks - V