diff --git a/src/babashka/pods/impl.clj b/src/babashka/pods/impl.clj index 0addfb3..d0beebf 100644 --- a/src/babashka/pods/impl.clj +++ b/src/babashka/pods/impl.clj @@ -29,7 +29,7 @@ (String. bytes)) (defn bytes->boolean [^"[B" bytes] - (boolean bytes)) + (= "true" (String. bytes))) (defn get-string [m k] (-> (get m k) @@ -142,7 +142,7 @@ name-sym (if vmeta (with-meta name-sym vmeta) name-sym) - metadata? (get-maybe-boolean var "read-meta?")] + metadata? (get-maybe-boolean var "arg-meta")] (when metadata? (swap! vars-with-metadata update (:pod-id pod) #(conj (set %) sym))) [name-sym diff --git a/test-pod/pod/test_pod.clj b/test-pod/pod/test_pod.clj index 7241018..9f98c90 100644 --- a/test-pod/pod/test_pod.clj +++ b/test-pod/pod/test_pod.clj @@ -137,7 +137,9 @@ "code" "(defn read-other-tag [x] [x x])" "meta" "{:doc \"unread\"}"} {"name" "round-trip-meta" - "read-meta?" "true"} + "arg-meta" "true"} + {"name" "dont-round-trip-meta" + "arg-meta" "false"} {"name" "-local-date-time"} {"name" "transit-stuff" "code" " @@ -244,6 +246,14 @@ "id" id "value" "#my/other-tag[1]"}) pod.test-pod/round-trip-meta + (write out + {"status" ["done"] + "id" id + "value" + (case format + :transit+json (transit-json-write-meta (first args)) + (write-fn (first args)))}) + pod.test-pod/dont-round-trip-meta (write out {"status" ["done"] "id" id diff --git a/test-resources/test_program.clj b/test-resources/test_program.clj index 245ac98..6bef8d1 100644 --- a/test-resources/test_program.clj +++ b/test-resources/test_program.clj @@ -94,6 +94,11 @@ (= {:my-meta 3} (meta (first (pod.test-pod/round-trip-meta [(with-meta [3] {:my-meta 3})])))) true)) +(def dont-round-trip-meta + (if (= "transit+json" fmt) + (= nil (meta (pod.test-pod/dont-round-trip-meta (with-meta [2] {:my-meta 2})))) + true)) + (require '[pod.test-pod.only-code :as only-code]) (def should-be-1 (only-code/foo)) @@ -128,6 +133,7 @@ assoc-string-array round-trip-meta round-trip-meta-nested + dont-round-trip-meta should-be-1 add-sync-meta error-meta diff --git a/test/.DS_Store b/test/.DS_Store new file mode 100644 index 0000000..4e1b901 Binary files /dev/null and b/test/.DS_Store differ diff --git a/test/babashka/.DS_Store b/test/babashka/.DS_Store new file mode 100644 index 0000000..cb8953e Binary files /dev/null and b/test/babashka/.DS_Store differ diff --git a/test/babashka/pods/test_common.clj b/test/babashka/pods/test_common.clj index a71da9f..e0b7d59 100644 --- a/test/babashka/pods/test_common.clj +++ b/test/babashka/pods/test_common.clj @@ -36,6 +36,7 @@ true ;; roundtrip string array true ;; roundtrip metadata true ;; roundtrip metadata nested + true ;; dont roundtrip metadata (when arg-meta "false"/ absent) 1 "add the arguments" nil