Skip to content

Commit

Permalink
Fixed the pull parser tests to call the pull parser lazy-parse
Browse files Browse the repository at this point in the history
  • Loading branch information
senior committed Oct 11, 2011
1 parent 240680e commit 7e8aa9a
Showing 1 changed file with 7 additions and 2 deletions.
Expand Up @@ -13,11 +13,16 @@
[clojure.data.xml :as xml :only [element]]
[clojure.data.xml.pull-parser :as pp :only []]))

(defn test-stream [x]
(java.io.ByteArrayInputStream. (.getBytes x)))

(def lazy-parse* (comp pp/lazy-parse test-stream))

(deftest simple
(let [input "<html><body bg=\"red\">This is <b>bold</b> test</body></html>"
expected (element :html {} (element :body {:bg "red"}
"This is " (element :b {} "bold") " test"))]
(with-in-str input (is (= expected (xml/lazy-parse *in*))))))
(is (= expected (lazy-parse* input)))))

(deftest deep
(let [input (str "<a h='1' i=\"2\" j='3'>"
Expand All @@ -35,4 +40,4 @@
" t7" (element :e {:l "5" :m "6"}
" t8" (element :f {} "t10") "t11")
" t12" (element :g {} "t13") "t14")]
(with-in-str input (is (= expected (xml/lazy-parse *in*))))))
(is (= expected (lazy-parse* input)))))

0 comments on commit 7e8aa9a

Please sign in to comment.