Skip to content

Commit d7caed2

Browse files
committed
fix tests and test-all task
1 parent c2134b9 commit d7caed2

File tree

2 files changed

+16
-18
lines changed

2 files changed

+16
-18
lines changed

Makefile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ SNAPSHOT ?= false
66
LIB = mokujin mokujin-logback
77

88
clean:
9-
$(foreach lib,$(LIB),clj -T:build clean :lib $(lib);)
9+
$(foreach lib,$(LIB),clojure -T:build clean :lib $(lib);)
1010

1111
jar:
12-
$(foreach lib,$(LIB),clj -T:build jar :lib $(lib) :snapshot $(SNAPSHOT);)
12+
$(foreach lib,$(LIB),clojure -T:build jar :lib $(lib) :snapshot $(SNAPSHOT);)
1313

1414

1515
install:
16-
$(foreach lib,$(LIB),clj -T:build install :lib $(lib) :snapshot $(SNAPSHOT);)
16+
$(foreach lib,$(LIB),clojure -T:build install :lib $(lib) :snapshot $(SNAPSHOT);)
1717

1818
publish: clean jar
19-
$(foreach lib,$(LIB),clj -T:build publish :lib $(lib) :snapshot $(SNAPSHOT);)
19+
$(foreach lib,$(LIB),clojure -T:build publish :lib $(lib) :snapshot $(SNAPSHOT);)
2020

2121
# Dev/test tasks
2222

@@ -28,16 +28,16 @@ test-all: test-core test-logback test-ex-logback test-ex-log4j2
2828
@echo "all done"
2929

3030
test-core:
31-
cd mokujin && clj -M:dev:test:run-tests
31+
cd mokujin && clojure -M:dev:test:run-tests
3232

3333
test-logback:
34-
cd mokujin-logback & clj -M:dev:test:run-tests
34+
cd mokujin-logback && clojure -M:dev:test:run-tests
3535

3636
test-ex-logback:
37-
cd examples/logback && clj -M:run
37+
cd examples/logback && clojure -M:run
3838

3939
test-ex-log4j2:
40-
cd examples/log4j2 && clj -M:run
40+
cd examples/log4j2 && clojure -M:run
4141

4242
benchmark:
4343
cd bench && clj -M:benchmark

mokujin/test/mokujin/log_test.clj

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
kaocha.plugin.capture-output
55
[clojure.string :as str]
66
[clojure.test :refer [deftest is testing]]
7-
[matcher-combinators.test]
8-
[matcher-combinators.core :refer [match?]]
7+
[matcher-combinators.test :refer [match?]]
98
[mokujin.log :as log])
109
(:import
1110
(org.slf4j MDC)))
@@ -91,10 +90,10 @@
9190
(deftest nested-contexts
9291
(log/with-context {:level-zero "0"}
9392
(run-in-thread
94-
(fn nested' []
95-
(log/with-context {:level-one "yes"}
96-
(log/with-context {:level-two "yes"}
97-
(log/info "ahem" {:level-three "yes"}))))))
93+
(fn nested' []
94+
(log/with-context {:level-one "yes"}
95+
(log/with-context {:level-two "yes"}
96+
(log/info "ahem" {:level-three "yes"}))))))
9897

9998
(let [captured-logs (parse-captured-logs)]
10099
(testing "contexts can be nested, but only work within current thread"
@@ -139,7 +138,7 @@
139138
(log/error "five"))
140139
(log/with-context {:foo :bar}
141140
(try
142-
(throw (ex-info "this is exception" {}))
141+
(throw (ex-info "this is exception" {:with "data"}))
143142
(catch Exception e
144143
(log/error e "six" {:fail true})))))
145144
(log/info "seven")))
@@ -156,16 +155,15 @@
156155
{:nested "again" :foo "bar"}
157156
{:fail "true" :nested "again" :foo "bar"}
158157
{}]
159-
captured-logs #_(map #(dissoc % :message :level :stack_trace)
160-
captured-logs))))
158+
captured-logs)))
161159
(testing "stack trace is included"
162160
(is (match? [{:fail "true"
163161
:nested "again"
164162
:foo "bar"
165163
:level "ERROR"
166164
:message "six"
167165
:stack_trace {:count 5
168-
:message "clojure.lang.ExceptionInfo: this is exception"}}]
166+
:message "clojure.lang.ExceptionInfo: this is exception {:with \"data\"}"}}]
169167
(filter :stack_trace captured-logs))))))
170168

171169
(deftest verify-nested-mdc

0 commit comments

Comments
 (0)