change to arg-meta, fix byte->boolean + added test
This commit is contained in:
parent
bdb0409889
commit
338304cd5c
6 changed files with 20 additions and 3 deletions
|
|
@ -29,7 +29,7 @@
|
||||||
(String. bytes))
|
(String. bytes))
|
||||||
|
|
||||||
(defn bytes->boolean [^"[B" bytes]
|
(defn bytes->boolean [^"[B" bytes]
|
||||||
(boolean bytes))
|
(= "true" (String. bytes)))
|
||||||
|
|
||||||
(defn get-string [m k]
|
(defn get-string [m k]
|
||||||
(-> (get m k)
|
(-> (get m k)
|
||||||
|
|
@ -142,7 +142,7 @@
|
||||||
name-sym (if vmeta
|
name-sym (if vmeta
|
||||||
(with-meta name-sym vmeta)
|
(with-meta name-sym vmeta)
|
||||||
name-sym)
|
name-sym)
|
||||||
metadata? (get-maybe-boolean var "read-meta?")]
|
metadata? (get-maybe-boolean var "arg-meta")]
|
||||||
(when metadata?
|
(when metadata?
|
||||||
(swap! vars-with-metadata update (:pod-id pod) #(conj (set %) sym)))
|
(swap! vars-with-metadata update (:pod-id pod) #(conj (set %) sym)))
|
||||||
[name-sym
|
[name-sym
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,9 @@
|
||||||
"code" "(defn read-other-tag [x] [x x])"
|
"code" "(defn read-other-tag [x] [x x])"
|
||||||
"meta" "{:doc \"unread\"}"}
|
"meta" "{:doc \"unread\"}"}
|
||||||
{"name" "round-trip-meta"
|
{"name" "round-trip-meta"
|
||||||
"read-meta?" "true"}
|
"arg-meta" "true"}
|
||||||
|
{"name" "dont-round-trip-meta"
|
||||||
|
"arg-meta" "false"}
|
||||||
{"name" "-local-date-time"}
|
{"name" "-local-date-time"}
|
||||||
{"name" "transit-stuff"
|
{"name" "transit-stuff"
|
||||||
"code" "
|
"code" "
|
||||||
|
|
@ -244,6 +246,14 @@
|
||||||
"id" id
|
"id" id
|
||||||
"value" "#my/other-tag[1]"})
|
"value" "#my/other-tag[1]"})
|
||||||
pod.test-pod/round-trip-meta
|
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
|
(write out
|
||||||
{"status" ["done"]
|
{"status" ["done"]
|
||||||
"id" id
|
"id" id
|
||||||
|
|
|
||||||
|
|
@ -94,6 +94,11 @@
|
||||||
(= {:my-meta 3} (meta (first (pod.test-pod/round-trip-meta [(with-meta [3] {:my-meta 3})]))))
|
(= {:my-meta 3} (meta (first (pod.test-pod/round-trip-meta [(with-meta [3] {:my-meta 3})]))))
|
||||||
true))
|
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])
|
(require '[pod.test-pod.only-code :as only-code])
|
||||||
(def should-be-1 (only-code/foo))
|
(def should-be-1 (only-code/foo))
|
||||||
|
|
||||||
|
|
@ -128,6 +133,7 @@
|
||||||
assoc-string-array
|
assoc-string-array
|
||||||
round-trip-meta
|
round-trip-meta
|
||||||
round-trip-meta-nested
|
round-trip-meta-nested
|
||||||
|
dont-round-trip-meta
|
||||||
should-be-1
|
should-be-1
|
||||||
add-sync-meta
|
add-sync-meta
|
||||||
error-meta
|
error-meta
|
||||||
|
|
|
||||||
BIN
test/.DS_Store
vendored
Normal file
BIN
test/.DS_Store
vendored
Normal file
Binary file not shown.
BIN
test/babashka/.DS_Store
vendored
Normal file
BIN
test/babashka/.DS_Store
vendored
Normal file
Binary file not shown.
|
|
@ -36,6 +36,7 @@
|
||||||
true ;; roundtrip string array
|
true ;; roundtrip string array
|
||||||
true ;; roundtrip metadata
|
true ;; roundtrip metadata
|
||||||
true ;; roundtrip metadata nested
|
true ;; roundtrip metadata nested
|
||||||
|
true ;; dont roundtrip metadata (when arg-meta "false"/ absent)
|
||||||
1
|
1
|
||||||
"add the arguments"
|
"add the arguments"
|
||||||
nil
|
nil
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue