From fb53e05ba724b9b4ac3dfe139ce635ac6b672fe7 Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Sat, 11 Apr 2020 12:24:56 +0200 Subject: [PATCH] [#340] fix interop with PushbackInputStream --- project.clj | 2 ++ sci | 2 +- test/babashka/main_test.clj | 10 ++++++++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/project.clj b/project.clj index 8dbf52a2..87d98573 100644 --- a/project.clj +++ b/project.clj @@ -8,6 +8,8 @@ :license {:name "Eclipse Public License 1.0" :url "http://opensource.org/licenses/eclipse-1.0.php"} :source-paths ["src" "sci/src" "babashka.curl/src"] + ;; for debugging Reflector.java code: + ;; :java-source-paths ["sci/reflector/src-java"] :resource-paths ["resources" "sci/resources"] :dependencies [[org.clojure/clojure "1.10.2-alpha1"] [org.clojure/tools.reader "1.3.2"] diff --git a/sci b/sci index 31f40662..f5161caf 160000 --- a/sci +++ b/sci @@ -1 +1 @@ -Subproject commit 31f406625481f9e74ff6ead730595cd8c7892955 +Subproject commit f5161cafd86bdd4a139d5427a26e5a3fa87734b1 diff --git a/test/babashka/main_test.clj b/test/babashka/main_test.clj index 51c626b4..7161b483 100644 --- a/test/babashka/main_test.clj +++ b/test/babashka/main_test.clj @@ -387,8 +387,14 @@ (deftest get-message-on-exception-info-test (is "foo" (bb nil "(try (throw (ex-info \"foo\" {})) (catch Exception e (.getMessage e)))"))) +(deftest pushback-reader-test + (is (= "foo" (bb nil " +(require '[clojure.java.io :as io]) +(let [pb (java.io.PushbackInputStream. (java.io.ByteArrayInputStream. (.getBytes \"foo\")))] + (.unread pb (.read pb)) + (slurp pb))")))) + ;;;; Scratch (comment - (dotimes [_ 10] (wait-for-port-test)) - ) + (dotimes [_ 10] (wait-for-port-test)))