Skip to content

Commit b2a85a7

Browse files
committed
Test match with symbols that mean strings.
1 parent ae3ebb7 commit b2a85a7

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

test/active/clojure/match_test.clj

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -292,48 +292,48 @@
292292
{:x 42})))))
293293

294294
(def x "x")
295-
(p/defpattern constant-pattern [(:x x)])
296-
(def p (p/parse-pattern '[(:x x)]))
295+
(p/defpattern constant-pattern [(X x)])
296+
(def p (p/parse-pattern '[(X x)]))
297297

298298
(t/deftest closes-over-outer-variables-test
299299
(t/testing "with compare-fn"
300-
(let [evt {:x "x"}]
300+
(let [evt {"X" "x"}]
301301
(t/is (= "x"
302-
((p/map-matcher [(:x (:compare-fn #(= % (:x evt))))] x)
302+
((p/map-matcher [(X (:compare-fn #(= % (get evt "X"))))] x)
303303
evt)))))
304304
(t/testing "as local constant"
305305
(let [x "x"
306-
evt {:x x}]
306+
evt {"X" x}]
307307
(t/is (= x
308-
((p/map-matcher [(:x x)] x)
308+
((p/map-matcher [(X x)] x)
309309
evt)))))
310310
(t/testing "as global constant"
311-
(let [evt {:x x}]
311+
(let [evt {"X" x}]
312312
(t/is (= x
313-
((p/map-matcher [(:x x)] x)
313+
((p/map-matcher [(X x)] x)
314314
evt)))))
315315
(t/testing "as constant with global defpattern"
316316
(let [x "x"
317-
evt {:x x}]
317+
evt {"X" x}]
318318
(t/is (= x
319319
((p/map-matcher constant-pattern x)
320320
evt)))))
321321
(t/testing "as constant with global parse-pattern"
322-
(let [evt {:x x}]
322+
(let [evt {"X" x}]
323323
(t/is (= x
324324
((p/map-matcher p x)
325325
evt)))))
326326
(t/testing "as constant with global defpattern"
327327
(let [x "x"
328-
evt {:x x}]
329-
(p/defpattern p [(:x x)])
328+
evt {"X" x}]
329+
(p/defpattern p [("X" x)])
330330
(t/is (= x
331331
((p/map-matcher p x)
332332
evt)))))
333333
#_(t/testing "as constant with local parse-pattern"
334334
(let [x "x"
335-
evt {:x x}
336-
p (p/parse-pattern [(:x x)])]
335+
evt {"X" x}
336+
p (p/parse-pattern [(X x)])]
337337
(t/is (= x
338338
((p/map-matcher p x)
339339
evt))))))

0 commit comments

Comments
 (0)