File tree Expand file tree Collapse file tree 2 files changed +26
-6
lines changed
src/cljc/matcher_combinators
test/clj/matcher_combinators Expand file tree Collapse file tree 2 files changed +26
-6
lines changed Original file line number Diff line number Diff line change 246246
247247(defn- type-preserving-mismatch [base-list values]
248248 (let [lst (into base-list values)]
249- (if (vector? base-list)
249+ (if (or (vector? base-list)
250+ (set? base-list))
250251 lst
251252 (reverse lst))))
252253
397398 {::result/type :match
398399 ::result/value elements
399400 ::result/weight 0 }
400- (match (->EqualsSeq (concat (:matched result)
401- (:unmatched result)))
402- (:elements result)))))
401+ (update (match (->EqualsSeq (concat (:matched result)
402+ (:unmatched result)))
403+ (:elements result))
404+ ::result/value
405+ #(with-mismatch-meta % :mismatch-sequence )))))
403406
404407(defn- match-any-order [expected actual subset?]
405408 (if-not (sequential? actual)
445448 " set" ))]
446449 issue
447450 (update (match-any-order (vec expected) (vec actual) false )
448- ::result/value set)))
451+ ::result/value
452+ #(with-meta (set %) (meta %)))))
449453 (-base-name [_] (if accept-seq? 'set-equals 'equals)))
450454
451455(defrecord Prefix [expected]
Original file line number Diff line number Diff line change 2626 (printer/as-string (list 'unexpected (printer/->ColorTag :red 1 )))))))
2727
2828(deftest abbreviated-matched-output-test
29+ (config/disable-abbreviation! )
2930 (is (= (str " [1\n 2\n {:a 2,\n :b [4 (mismatch (expected " (colorize/yellow 5 ) " ) (actual " (colorize/red 6 ) " ))],\n :c [2 [3 4]]}]\n " )
3031 (printer/as-string
3132 (:matcher-combinators.result/value
4344 (printer/as-string
4445 (:matcher-combinators.result/value
4546 (c/match [1 2 {:a 2 :b [4 5 ] :c [2 [3 4 ]]}]
46- [1 2 {:a 2 :b [4 6 ] :c [2 [3 4 ]]}]))))))
47+ [1 2 {:a 2 :b [4 6 ] :c [2 [3 4 ]]}])))))
48+ (config/disable-abbreviation! ))
49+
50+ (deftest abbreviated-set-output-test
51+ (config/disable-abbreviation! )
52+ (is (= (str " [#{(unexpected " (colorize/red 1 ) " ) 2}]\n " )
53+ (printer/as-string
54+ (:matcher-combinators.result/value
55+ (c/match [#{2 }] [#{1 2 }])))))
56+
57+ (config/enable-abbreviation! )
58+ (is (= (str " [#{(unexpected " (colorize/red 1 ) " )} ...]\n " )
59+ (printer/as-string
60+ (:matcher-combinators.result/value
61+ (c/match [#{2 }] [#{1 2 }])))))
62+ (config/disable-abbreviation! ))
You can’t perform that action at this time.
0 commit comments