Skip to content

Commit 91f29b2

Browse files
committed
Redo test as a vector of lines instead of a string.
This test is difficult to work with as-is because it's one big string, and deep-diff2 (currently) shows only that two strings differ, and not the substrings in particular that cause the mismatch.
1 parent 1dc8802 commit 91f29b2

1 file changed

Lines changed: 26 additions & 10 deletions

File tree

test/unit/kaocha/watch_test.clj

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
[kaocha.config :as config]
1414
[clojure.test :as t]
1515
[clojure.string :as str]
16-
[slingshot.slingshot :refer [try+]])
16+
[slingshot.slingshot :refer [try+]]
17+
[matcher-combinators.matchers :as matchers]
18+
)
1719
(:import (java.io File)))
1820

1921
(require 'matcher-combinators.test)
@@ -131,15 +133,29 @@
131133
(w/qput q :finish)
132134
(Thread/sleep 100)
133135

134-
(is (str/includes?
135-
@out-str
136-
(str/replace
137-
(str/replace
138-
"[(F)]\n\nFAIL in foo.bar-test/xxx-test (bar_test.clj:1)\nExpected:\n :xxx\nActual:\n -:xxx +:yyy\n1 tests, 1 assertions, 1 failures.\n\nbin/kaocha --config-file PATH --focus 'foo.bar-test/xxx-test'\n\n[watch] Reloading #{foo.bar-test}\n[watch] Re-running failed tests #{:foo.bar-test/xxx-test}\n[(F)]\n\nFAIL in foo.bar-test/xxx-test (bar_test.clj:1)\nExpected:\n :xxx\nActual:\n -:xxx +:zzz"
139-
"foo"
140-
prefix)
141-
"PATH"
142-
(str config-file))))))
136+
(is (match?
137+
(matchers/embeds
138+
["[(F)]"
139+
""
140+
(str/replace "FAIL in foo.bar-test/xxx-test (bar_test.clj:1)" "foo" prefix)
141+
"Expected:"
142+
" :xxx"
143+
"Actual:"
144+
" -:xxx +:yyy"
145+
"1 tests, 1 assertions, 1 failures."
146+
""
147+
(format "bin/kaocha --config-file %s --focus '%s.bar-test/xxx-test'" (str config-file) prefix)
148+
""
149+
(str/replace "[watch] Reloading #{foo.bar-test}" "foo" prefix)
150+
(str/replace "[watch] Re-running failed tests #{:foo.bar-test/xxx-test}" "foo" prefix)
151+
"[(F)]"
152+
""
153+
(str/replace "FAIL in foo.bar-test/xxx-test (bar_test.clj:1)" "foo" prefix)
154+
"Expected:"
155+
" :xxx"
156+
"Actual:"
157+
" -:xxx +:zzz"])
158+
(str/split-lines @out-str)))))
143159

144160
(deftest ignore-files-merged
145161
(let [{:keys [_config-file test-dir] :as m} (integration/test-dir-setup {})]

0 commit comments

Comments
 (0)