-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #897 from armed/master
fix show function FQN in instrumentation exception
- Loading branch information
Showing
2 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
(ns malli.dev-err-test | ||
(:require [clojure.test :refer [deftest is testing]] | ||
[malli.dev :as md] | ||
[malli.dev.pretty :as pretty])) | ||
|
||
(defn plus-err | ||
[x] (inc x)) | ||
|
||
(defn ->plus-err [] plus-err) | ||
|
||
(deftest start!-err-test | ||
(testing "malli.dev/start!" | ||
(testing "without starting" | ||
(is (thrown? ClassCastException ((->plus-err) "2"))) | ||
(is (= 7 ((->plus-err) 6)))) | ||
|
||
(testing "instrumentation shema error when starting" | ||
;; append metadata only during test to prevent conflicts with other tests | ||
(alter-meta! #'plus-err #(assoc % :malli/schema [:=> [:cat [:vector]] [:int {:max 6}]])) | ||
(try | ||
(is (thrown-with-msg? | ||
Exception #"Schema error when insrumenting function: malli.dev-err-test/plus-err - :malli.core/child-error" | ||
(md/start! {:ns *ns*}))) | ||
(catch Throwable _ | ||
(md/stop!))) | ||
(alter-meta! #'plus-err #(dissoc % :malli/schema))))) | ||
|