From 283cb13e58d4c93b78151d75b26422e73d63058e Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Wed, 24 Nov 2021 12:06:29 +0100 Subject: [PATCH] Add compatibility with babashka --- src/net/cgrand/xforms.cljc | 3 ++- test/net/cgrand/xforms_test.cljc | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/net/cgrand/xforms.cljc b/src/net/cgrand/xforms.cljc index 3740693..0a54dd2 100644 --- a/src/net/cgrand/xforms.cljc +++ b/src/net/cgrand/xforms.cljc @@ -99,7 +99,8 @@ (not (arities 2)) (conj (let [[[acc karg varg] & body] (arities 3)] `([~acc [~karg ~varg]] ~@body))))] `(reify - ~@(macros/case :clj '[clojure.lang.Fn]) + #?@(:bb [] ;; babashka currently only supports reify with one Java interface at a time + :default [~@(macros/case :clj '[clojure.lang.Fn])]) KvRfable (some-kvrf [this#] this#) ~(macros/case :cljs `core/IFn :clj 'clojure.lang.IFn) diff --git a/test/net/cgrand/xforms_test.cljc b/test/net/cgrand/xforms_test.cljc index d3b0466..54b62e9 100644 --- a/test/net/cgrand/xforms_test.cljc +++ b/test/net/cgrand/xforms_test.cljc @@ -94,7 +94,8 @@ (is (= {0 :ok 2 :ok 4 :ok 6 :ok 8 :ok} (x/without (zipmap (range 10) (repeat :ok)) (filter odd?) (range 20)))) (is (= #{0 2 4 6 8 } (x/without (set (range 10)) (filter odd?) (range 20))))) -#?(:clj +#?(:bb nil ;; babashka doesn't currently support calling iterator on range type + :clj (deftest iterator (is (true? (.hasNext (x/iterator x/count (.iterator (range 5)))))) (is (is (= [5] (iterator-seq (x/iterator x/count (.iterator (range 5))))))) @@ -139,4 +140,4 @@ (is (= (range 100) (x/into [] (x/sort) (shuffle (range 100))))) (is (= (reverse (range 100)) (x/into [] (x/sort >) (shuffle (range 100))))) (is (= (sort-by str (range 100)) (x/into [] (x/sort-by str) (shuffle (range 100))))) - (is (= (sort-by str (comp - compare) (range 100)) (x/into [] (x/sort-by str (comp - compare)) (shuffle (range 100)))))) \ No newline at end of file + (is (= (sort-by str (comp - compare) (range 100)) (x/into [] (x/sort-by str (comp - compare)) (shuffle (range 100))))))