File tree Expand file tree Collapse file tree
test/clojure/test_clojure Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -50,6 +50,7 @@ clojure.test-clojure.string
5050clojure.test-clojure.test
5151clojure.test-clojure.test-fixtures
5252clojure.test-clojure.transients
53+ clojure.test-clojure.try-catch
5354clojure.test-clojure.vars
5455clojure.test-clojure.vectors
5556])
Original file line number Diff line number Diff line change 1+ ; Copyright (c) Rich Hickey. All rights reserved.
2+ ; The use and distribution terms for this software are covered by the
3+ ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
4+ ; which can be found in the file epl-v10.html at the root of this distribution.
5+ ; By using this software in any fashion, you are agreeing to be bound by
6+ ; the terms of this license.
7+ ; You must not remove this notice, or any other, from this software.
8+
9+ ; Author: Paul M Bauer
10+
11+ (ns clojure.test-clojure.try-catch
12+ (:use clojure.test))
13+
14+ (defn- get-exception [expression]
15+ (try (eval expression)
16+ nil
17+ (catch java.lang.Throwable t
18+ t)))
19+
20+ (deftest catch-receives-checked-exception
21+ (are [expression expected-exception] (= expected-exception
22+ (type (get-exception expression)))
23+ " Eh, I'm pretty safe" nil
24+ '(java.io.FileReader. " CAFEBABEx0/idonotexist" ) java.io.FileNotFoundException))
You can’t perform that action at this time.
0 commit comments