diff --git a/test/babashka/test_utils.clj b/test/babashka/test_utils.clj index 8f9a75b2..0c6da084 100644 --- a/test/babashka/test_utils.clj +++ b/test/babashka/test_utils.clj @@ -14,15 +14,19 @@ (set! *warn-on-reflection* true) -(defn string-replace-if-windows [match replacement] - (fn [s] - (if main/windows? - (str/replace s match replacement) - s))) +(def normalize + (if main/windows? + (fn [s] (if (string? s) + (str/replace s "\r\n" "\n") + s)) + identity)) -(def normalize (string-replace-if-windows "\r\n" "\n")) - -(def escape-file-paths (string-replace-if-windows "\\" "\\\\")) +(def escape-file-paths + (if main/windows? + (fn [s] (if (string? s) + (str/replace s "\\" "\\\\") + s)) + identity)) (def ^:dynamic *bb-edn-path* nil)