From fc4ee453354ad310a6cb6daf4ef4da3a0ebbfcc5 Mon Sep 17 00:00:00 2001 From: Oleksandr Yakushev Date: Fri, 4 Apr 2025 15:29:52 +0300 Subject: [PATCH] [test] Don't turn records into maps when post-processing test results --- src/cider/nrepl/middleware/test.clj | 2 +- test/clj/cider/nrepl/middleware/test_test.clj | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/cider/nrepl/middleware/test.clj b/src/cider/nrepl/middleware/test.clj index a0c7999b..a43a2eb6 100644 --- a/src/cider/nrepl/middleware/test.clj +++ b/src/cider/nrepl/middleware/test.clj @@ -78,7 +78,7 @@ (try (walk/postwalk (fn [x] - (if (map? x) + (if (and (map? x) (not (record? x))) ;; Prevent records turning into maps (with-meta (into (sorted-map) x) (meta x)) x)) m) diff --git a/test/clj/cider/nrepl/middleware/test_test.clj b/test/clj/cider/nrepl/middleware/test_test.clj index e154955b..9a08d30d 100644 --- a/test/clj/cider/nrepl/middleware/test_test.clj +++ b/test/clj/cider/nrepl/middleware/test_test.clj @@ -6,7 +6,8 @@ [clojure.string :as string] [clojure.test :refer :all] [matcher-combinators.clj-test] - [matcher-combinators.matchers :as matchers]) + [matcher-combinators.matchers :as matchers] + [matcher-combinators.model]) (:import (clojure.lang ExceptionInfo))) @@ -199,10 +200,10 @@ (deftest print-object-test (testing "uses println for matcher-combinators results, otherwise invokes pprint" - (is (= "{no quotes}\n" + (is (= "(mismatch (expected 1) (actual 2))\n" (#'test/print-object (matcher-combinators.clj-test/tagged-for-pretty-printing '(not (match? 1 2)) - {:matcher-combinators.result/value {"no" "quotes"}}))) + {:matcher-combinators.result/value (matcher-combinators.model/->Mismatch "1" "2")}))) "println is chosen, as indicated by strings printed without quotes") (is (= "{:a\n (\"a-sufficiently-long-string\"\n \"a-sufficiently-long-string\"\n \"a-sufficiently-long-string\")}\n" (#'test/print-object {:a (repeat 3 "a-sufficiently-long-string")}))