From f830588bf0eacfc7409595da0f28fe1db82ea1ea Mon Sep 17 00:00:00 2001 From: Greg Look Date: Sat, 25 Apr 2015 11:22:51 -0700 Subject: [PATCH] Remove tagged-literal functions. These clash with clojure 1.7 built-ins, and aren't actually used by the rest of the code. Fixes #20. --- src/puget/data.clj | 47 ++----------------------------------- test/puget/data_test.clj | 12 ---------- test/puget/printer_test.clj | 7 ------ 3 files changed, 2 insertions(+), 64 deletions(-) diff --git a/src/puget/data.clj b/src/puget/data.clj index 7d5e02b..b070840 100644 --- a/src/puget/data.clj +++ b/src/puget/data.clj @@ -11,50 +11,7 @@ (->edn [value] "Converts the given value into a tagged value representation for EDN - serialization. Returns a `TaggedLiteral` record.")) - - -; TODO: remove this when CLJ-1424 merges -; http://dev.clojure.org/jira/browse/CLJ-1424 -(defrecord TaggedLiteral - [tag form] - - ExtendedNotation - - (->edn - [this] - this) - - - Object - - (toString - [this] - (str \# tag \space (pr-str form)))) - - -;; Remove automatic constructor functions. -(ns-unmap *ns* '->TaggedLiteral) -(ns-unmap *ns* 'map->TaggedLiteral) - - -(defmethod print-method TaggedLiteral - [v ^java.io.Writer w] - (.write w (str v))) - - -(defn tagged-literal - "Creates a generic tagged value record to represent some EDN value. This is - suitable for use as a default-data-reader function." - [tag value] - {:pre [(symbol? tag)]} - (TaggedLiteral. tag value)) - - -(defn tagged-literal? - "Returns true if the given value is a tagged-literal form." - [value] - (instance? TaggedLiteral value)) + serialization. Should return a value with a `:tag` and a `:form`.")) @@ -70,7 +27,7 @@ ExtendedNotation (->edn [this#] - (tagged-literal ~tag (value-fn# this#)))))) + (array-map :tag ~tag :form (value-fn# this#)))))) (defmacro extend-tagged-str diff --git a/test/puget/data_test.clj b/test/puget/data_test.clj index baa4f4c..c37cf72 100644 --- a/test/puget/data_test.clj +++ b/test/puget/data_test.clj @@ -24,18 +24,6 @@ 'uuid "96d91316-53b9-4800-81c1-97ae9f4b86b0")) -(deftest generic-tagged-literal - (let [data (data/tagged-literal 'foo :bar) - {:keys [tag form]} (data/->edn data) - string (str data)] - (is (data/tagged-literal? data)) - (is (= 'foo tag)) - (is (= :bar form)) - (is (= "#foo :bar" string)) - (is (= "#foo :bar" (pr-str data))) - (is (= data (edn/read-string {:default data/tagged-literal} string))))) - - (defrecord TestRecord [x y]) (data/extend-tagged-map TestRecord 'test/record) (deftest tagged-literal-extension diff --git a/test/puget/printer_test.clj b/test/puget/printer_test.clj index a34a351..54f6822 100644 --- a/test/puget/printer_test.clj +++ b/test/puget/printer_test.clj @@ -121,13 +121,6 @@ (pprint-str v)))))) -(deftest formatting-tagged-literals - (let [tv (data/tagged-literal 'foo :bar/baz)] - (is (= "#foo :bar/baz" (pprint-str tv)))) - (let [tv (data/tagged-literal 'frobble/biznar [:foo :bar :baz])] - (is (= "#frobble/biznar\n[:foo :bar :baz]" (pprint-str tv))))) - - (deftype ComplexValue [] Object (toString [_] "to-string"))