Back

repl-caught (clj)

(source)

function

(repl-caught e)
Default :caught hook for repl

Examples

clojure/core.typed
(deftest demunge-test
  (is-tc-e (demunge "abc") String 
           :requires [[clojure.main :refer [demunge]]])
  (is-tc-err (demunge "abc") Boolean
             :requires [[clojure.main :refer [demunge]]])
  (is-tc-err (demunge 1) String 
             :requires [[clojure.main :refer [demunge]]]))

(deftest repl-test
  (is-tc-e #(repl)
           :requires [[clojure.main :refer [repl]]])
  (is-tc-e #(repl :init (fn [])
                  :need-prompt (fn [] (identity true))
                  :flush flush
                  :read repl-read
                  :eval eval
                  :print prn
                  :caught repl-caught)
           :requires [[clojure.main :refer [repl repl-read repl-caught]]]))

(deftest repl-caught-test
  (is-tc-e #(repl-caught (Exception. "a"))
           :requires [[clojure.main :refer [repl-caught]]])
  (is-tc-err #(repl-caught "A") Any
             :requires [[clojure.main :refer [repl-caught]]]))
typedclojure/typedclojure
(deftest demunge-test
  (is-tc-e (demunge "abc") String 
           :requires [[clojure.main :refer [demunge]]])
  (is-tc-err (demunge "abc") Boolean
             :requires [[clojure.main :refer [demunge]]])
  (is-tc-err (demunge 1) String 
             :requires [[clojure.main :refer [demunge]]]))

(deftest repl-test
  (is-tc-e #(repl)
           :requires [[clojure.main :refer [repl]]])
  (is-tc-e #(repl :init (fn [])
                  :need-prompt (fn [] (identity true))
                  :flush flush
                  :read repl-read
                  :eval eval
                  :print prn
                  :caught repl-caught)
           :requires [[clojure.main :refer [repl repl-read repl-caught]]]))

(deftest repl-caught-test
  (is-tc-e #(repl-caught (Exception. "a"))
           :requires [[clojure.main :refer [repl-caught]]])
  (is-tc-err #(repl-caught "A") t/Any
             :requires [[clojure.main :refer [repl-caught]]]))