Permalink
Browse files

Added test for cdata in sexp-as-element that contains an embedded ]]>…

… (DXML-12)
  • Loading branch information...
1 parent cf810dc commit f5f0ae17226c96d7ea63384938fca0883e01c792 @senior senior committed Jan 9, 2013
Showing with 20 additions and 9 deletions.
  1. +20 −9 src/test/clojure/clojure/data/xml/test_sexp.clj
@@ -34,15 +34,26 @@
(sexp-as-element sexp-input)))))
(deftest with-multiple-cdata
- (let [xml-input (element :tag {:attr "value"}
- (element :body {}
- (cdata "not parsed <stuff")
- (cdata "more not parsed <stuff")))
- sexp-input [:tag {:attr "value"} [:body {}
- (list [:-cdata "not parsed <stuff"]
- [:-cdata "more not parsed <stuff"])]]]
- (is (= xml-input
- (sexp-as-element sexp-input)))))
+ (testing "separate cdata"
+ (let [xml-input (element :tag {:attr "value"}
+ (element :body {}
+ (cdata "not parsed <stuff")
+ (cdata "more not parsed <stuff")))
+ sexp-input [:tag {:attr "value"} [:body {}
+ (list [:-cdata "not parsed <stuff"]
+ [:-cdata "more not parsed <stuff"])]]]
+ (is (= xml-input
+ (sexp-as-element sexp-input)))))
+ (testing "cdata with embedded ]]>"
+ (let [xml-input (element :tag {:attr "value"}
+ (element :body {}
+ (cdata "not parsed <stuff")
+ (cdata "more not parsed <stuff")))
+ sexp-input [:tag {:attr "value"}
+ [:body {}
+ [:-cdata "not parsed <stuff]]>more not parsed <stuff"]]]]
+ (is (= (emit-str xml-input)
+ (emit-str (sexp-as-element sexp-input)))))))
(deftest with-comment
(let [xml-input (element :tag {:attr "value"}

0 comments on commit f5f0ae1

Please sign in to comment.