Skip to content

Commit 9e9aa3a

Browse files
committed
fix: match clj resolve exception message
Fix babashka/babashka#1871
1 parent 6758ba0 commit 9e9aa3a

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ aren't visible to other users:
560560
(def forked (sci/fork sci-ctx))
561561
(sci/eval-string* forked "(def forked 1)")
562562
(sci/eval-string* forked "forked") ;;=> 1
563-
(sci/eval-string* sci-ctx "forked") ;;=> Could not resolved symbol: forked
563+
(sci/eval-string* sci-ctx "forked") ;;=> Unable to resolve symbol: forked
564564
```
565565

566566
### Implementing require and load-file

src/sci/impl/resolve.cljc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,5 +282,5 @@
282282
#?(:cljs (let [resolved (resolve-dotted-access ctx sym call? m)]
283283
resolved))
284284
(throw-error-with-location
285-
(str "Could not resolve symbol: " sym)
285+
(str "Unable to resolve symbol: " sym)
286286
sym)))))

test/sci/core_test.cljc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1262,7 +1262,7 @@
12621262
(sci/eval-string* forked "y"))))
12631263
(is (thrown-with-msg?
12641264
#?(:clj Exception :cljs js/Error)
1265-
#"Could not resolve symbol: y" (sci/eval-string* ctx "y"))))))
1265+
#"Unable to resolve symbol: y" (sci/eval-string* ctx "y"))))))
12661266

12671267
(defmacro do-twice [x] `(do ~x ~x))
12681268
(defn ^:sci/macro do-twice* [_ _ x] `(do ~x ~x))

test/sci/interop_test.cljc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
(is (= 32 (eval* "(. Integer -SIZE)")))
7575
(is (= 32 (eval* "(. Integer SIZE)")))
7676
(testing "calling static field on unconfigured classes is not allowed"
77-
(is (thrown-with-msg? Exception #"not"
77+
(is (thrown-with-msg? Exception #"to resolve"
7878
(eval* "clojure.lang.Var/rev"))))))
7979

8080
#?(:clj
@@ -113,7 +113,7 @@
113113
(is (= 123 (eval* "(defmacro parse-int [x] `(. Integer (parseInt ~x)))
114114
(parse-int \"123\")")))
115115
(testing "calling static methods on unconfigured classes is not allowed"
116-
(is (thrown-with-msg? Exception #"not"
116+
(is (thrown-with-msg? Exception #"to resolve"
117117
(eval* "(clojure.lang.Var/find 'clojure.core/int)"))))
118118
(is (= :dude (sci/eval-string
119119
"(Class/forName \"java.lang.String\")"

test/sci/namespaces_test.cljc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
(is (= 16 (eval* "(ns foo (:refer-clojure :rename {bit-shift-left <<})) (<< 8 1)")))
5151
(is (thrown-with-msg?
5252
#?(:clj Exception :cljs js/Error)
53-
#"not.*resolve.*bit-shift-left"
53+
#"to.*resolve.*bit-shift-left"
5454
(eval* "(ns foo (:refer-clojure :rename {bit-shift-left <<})) (bit-shift-left 8 1)"))))
5555
(when-not tu/native?
5656
(testing "load-fn + requiring-resolve"
@@ -73,11 +73,11 @@
7373
(is (= #{1 2} (eval* "(use '[clojure.set :only [union]]) (union #{1} #{2})")))
7474
(is (thrown-with-msg?
7575
#?(:clj Exception :cljs js/Error)
76-
#"not.*resolve.*union"
76+
#"to.*resolve.*union"
7777
(eval* "(use '[clojure.set :exclude [union]]) (union #{1} #{2})")))
7878
(is (thrown-with-msg?
7979
#?(:clj Exception :cljs js/Error)
80-
#"not.*resolve.*union"
80+
#"to.*resolve.*union"
8181
(eval* "(use '[clojure.set :only [difference]]) (union #{1} #{2})")))
8282
(is (thrown-with-msg?
8383
#?(:clj Exception :cljs js/Error)

0 commit comments

Comments
 (0)