From 187ee7da00b9e551d0c01d1f131c1de4e10ba1aa Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Sat, 25 Feb 2023 21:33:55 +0100 Subject: [PATCH] Add support for .getWatches on atoms --- src/babashka/impl/classes.clj | 4 +++- test/babashka/main_test.clj | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/babashka/impl/classes.clj b/src/babashka/impl/classes.clj index 96a114ea..f09b9e12 100644 --- a/src/babashka/impl/classes.clj +++ b/src/babashka/impl/classes.clj @@ -158,7 +158,9 @@ {:methods [{:name "getResource"} {:name "getResources"} {:name "getResourceAsStream"} - {:name "getParent"}]}}) + {:name "getParent"}]} + clojure.lang.ARef + {:methods [{:name "getWatches"}]}}) (def custom-map (cond-> diff --git a/test/babashka/main_test.clj b/test/babashka/main_test.clj index fe0adbd3..26b2e28a 100644 --- a/test/babashka/main_test.clj +++ b/test/babashka/main_test.clj @@ -843,6 +843,9 @@ true"))) (deftest index-of-test (is (= 1 (bb nil "(.indexOf (map inc [1 2 3]) 3)")))) +(deftest get-watches-test + (is (true? (bb nil "(map? (.getWatches (doto (atom nil) (add-watch :foo (fn [k r o n])))))" )))) + ;;;; Scratch (comment