From ed360808d94ea0e637881158b393da52827573e9 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 28 Sep 2014 14:22:51 +0100 Subject: select-h: use zippers for easier recursion That was far too easy. --- test/microformats/parser_expectations.clj | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'test') diff --git a/test/microformats/parser_expectations.clj b/test/microformats/parser_expectations.clj index 455a26f..5f8eeef 100644 --- a/test/microformats/parser_expectations.clj +++ b/test/microformats/parser_expectations.clj @@ -1,6 +1,7 @@ (ns microformats.parser-expectations (:require [expectations :refer :all] [microformats.parser :refer :all] + [clojure.zip :as z] [net.cgrand.enlive-html :refer [html-snippet]])) (defn- snippet @@ -25,25 +26,25 @@ (#'microformats.parser/node-to-text))) (expect '({:tag :div :attrs {:class "h-card"} - :content nil}) - (select-h (snippet - "
"))) + :content nil}) + (select-h (z/xml-zip (html-snippet + "
")))) (expect '({:tag :div :attrs {:class "h-card"} - :content ({:tag :a :attrs {:class "h-org"} - :content nil})}) - (select-h (snippet - "
"))) + :content ({:tag :a :attrs {:class "h-org"} + :content nil})}) + (select-h (z/xml-zip (html-snippet + "
")))) (expect '({:tag :div :attrs {:class "h-card"} - :content ("\n" - {:tag :p :attrs nil - :content ({:tag :a :attrs {:class "h-org"} - :content nil})} - "\n")}) - (select-h (snippet "
+ :content ("\n" + {:tag :p :attrs nil + :content ({:tag :a :attrs {:class "h-org"} + :content nil})} + "\n")}) + (select-h (z/xml-zip (html-snippet "

-
"))) +
")))) (expect {:name '("Name")} (parse-p (snippet "

Name

"))) -- cgit 1.4.1