From c773b522ebafbdfc9019898a83d74503700352e5 Mon Sep 17 00:00:00 2001
From: Alan Pearce
Date: Sun, 28 Sep 2014 20:57:02 +0100
Subject: Use lists instead of vectors
Allows for some simplification.
---
test/microformats/parser_expectations.clj | 107 ++++++++++++++++--------------
1 file changed, 56 insertions(+), 51 deletions(-)
(limited to 'test')
diff --git a/test/microformats/parser_expectations.clj b/test/microformats/parser_expectations.clj
index b22e3a9..1c6d4f1 100644
--- a/test/microformats/parser_expectations.clj
+++ b/test/microformats/parser_expectations.clj
@@ -27,14 +27,19 @@
(expect '({:tag :div :attrs {:class "h-card"}
:content nil})
- (select-h (z/xml-zip (html-snippet
- "
+ (map-h identity (z/xml-zip (snippet "
"))))
@@ -136,77 +141,77 @@
(expect {:content '({:html "Here is a load of
embedded markup " :value "Here is a load of embedded markup"})}
(parse-e (snippet "
Here is a load of embedded markup
")))
-(expect {:author ["http://example.com/a"]}
+(expect {:author '("http://example.com/a")}
(parse-rels (html-snippet "
author a ")))
-(expect {:author ["http://example.com/a" "http://example.com/b"]}
+(expect {:author '("http://example.com/a" "http://example.com/b")}
(parse-rels (html-snippet "
author a
author b ")))
-(expect {:items [] :rels {}}
+(expect {:items nil :rels {}}
(parse ""))
-(expect {:items [{:properties {:name '("Example User")} :type ["h-card"]}] :rels {}}
+(expect {:items '({:properties {:name ("Example User")} :type ("h-card")}) :rels {}}
(parse "
"))
-(expect {:items [{:properties {:name '("Example User")} :type ["h-card"]}] :rels {}}
+(expect {:items '({:properties {:name ("Example User")} :type ("h-card")}) :rels {}}
(parse "
"))
-(expect {:items [{:properties {:name '("Example User")} :type ["h-card"]}] :rels {}}
+(expect {:items '({:properties {:name ("Example User")} :type ("h-card")}) :rels {}}
(parse "
"))
-(expect {:items [{:properties {:name '("Example User") :url '("http://example.com")}
- :type ["h-card"]}] :rels {}}
+(expect {:items '({:properties {:name ("Example User") :url ("http://example.com")}
+ :type ("h-card")}) :rels {}}
(parse "
"))
-(expect {:items [{:type ["h-card"] :properties {:name '("Example User")}}] :rels {}}
+(expect {:items '({:type ("h-card") :properties {:name ("Example User")}}) :rels {}}
(parse "
Example User
"))
-(expect {:items [{:type ["h-card"] :properties {:name '("Example User") :url '("http://example.com")}}] :rels {}}
+(expect {:items '({:type ("h-card") :properties {:name ("Example User") :url ("http://example.com")}}) :rels {}}
(parse "
Example User "))
-(expect {:items [{:type ["h-card"] :properties {:name '("Example User")
- :photo '("http://example.com/me.png")}}] :rels {}}
+(expect {:items '({:type ("h-card") :properties {:name ("Example User")
+ :photo ("http://example.com/me.png")}}) :rels {}}
(parse "
"))
-(expect {:items [{:type ["h-card"] :properties {:name '("Example User")}}] :rels {}}
+(expect {:items '({:type ("h-card") :properties {:name ("Example User")}}) :rels {}}
(parse "
Incorrect "))
-(expect {:items [{:type ["h-card"] :properties {:name '("Example User")}}] :rels {}}
+(expect {:items '({:type ("h-card") :properties {:name ("Example User")}}) :rels {}}
(parse "
"))
-(expect {:items [{:type ["h-card"] :properties {:name '("Example User")}}] :rels {}}
+(expect {:items '({:type ("h-card") :properties {:name ("Example User")}}) :rels {}}
(parse "
Wrong
"))
-(expect {:items [{:type ["h-card"] :properties {:name '("Example User")}}] :rels {}}
+(expect {:items '({:type ("h-card") :properties {:name ("Example User")}}) :rels {}}
(parse "
"))
-(expect {:items [{:type ["h-card"] :properties {:name '("Example User")}}] :rels {}}
+(expect {:items '({:type ("h-card") :properties {:name ("Example User")}}) :rels {}}
(parse "
"))
-(expect {:items [{:type ["h-card"] :properties {:photo '("http://example.com/me.png")}}] :rels {}}
+(expect {:items '({:type ("h-card") :properties {:photo ("http://example.com/me.png")}}) :rels {}}
(parse "
"))
-(expect {:items [{:type ["h-card"] :properties {:name '("Example User")
- :photo '("http://example.com/me.png")}}] :rels {}}
+(expect {:items '({:type ("h-card") :properties {:name ("Example User")
+ :photo ("http://example.com/me.png")}}) :rels {}}
(parse "
"))
-(expect {:items [{:type ["h-card"] :properties {:photo '("http://example.com/me.png")}}] :rels {}}
+(expect {:items '({:type ("h-card") :properties {:photo ("http://example.com/me.png")}}) :rels {}}
(parse "
"))
-(expect {:items [{:type ["h-card"] :properties {:photo '("http://example.com/me.png")}}] :rels {}}
+(expect {:items '({:type ("h-card") :properties {:photo ("http://example.com/me.png")}}) :rels {}}
(parse "
"))
-(expect {:items [{:type ["h-card"] :properties {:name '("Example User")
- :photo '("http://example.com/me.png")}}] :rels {}}
+(expect {:items '({:type ("h-card") :properties {:name ("Example User")
+ :photo ("http://example.com/me.png")}}) :rels {}}
(parse "
"))
-(expect {:items [{:type ["h-card"] :properties {:name '("Example User") :url '("http://example.com")}}] :rels {}}
+(expect {:items '({:type ("h-card") :properties {:name ("Example User") :url ("http://example.com")}}) :rels {}}
(parse "
"))
-(expect {:items [{:type ["h-card"] :properties {:name '("Example")
- :url '("http://example.com"
- "http://myblog.com")}}]
+(expect {:items '({:type ("h-card") :properties {:name ("Example")
+ :url ("http://example.com"
+ "http://myblog.com")}})
:rels {}}
(parse "
Example
@@ -214,9 +219,9 @@
My Blog
"))
-(expect {:items [{:type ["h-card"]
- :properties {:name '("Example")
- :tel '("01234567890")}}]
+(expect {:items '({:type ("h-card")
+ :properties {:name ("Example")
+ :tel ("01234567890")}})
:rels {}}
(parse "
Example
@@ -225,14 +230,14 @@
"))
(expect
- {:items [{:type ["h-adr"],
- :properties {:street-address '("665 3rd St."),
- :extended-address '("Suite 207"),
- :locality '("San Francisco"),
- :region '("CA"),
- :postal-code '("94107"),
- :country-name '("U.S.A."),
- :name '("665 3rd St. Suite 207 San Francisco, CA 94107 U.S.A.")}}]
+ {:items '({:type ("h-adr"),
+ :properties {:street-address ("665 3rd St."),
+ :extended-address ("Suite 207"),
+ :locality ("San Francisco"),
+ :region ("CA"),
+ :postal-code ("94107"),
+ :country-name ("U.S.A."),
+ :name ("665 3rd St. Suite 207 San Francisco, CA 94107 U.S.A.")}})
:rels {}}
(parse "
665 3rd St.
@@ -243,16 +248,16 @@
U.S.A.
"))
-(expect {:items [{:type ["h-card" "h-org"]
- :properties {:name '("Example")}}]
+(expect {:items '({:type ("h-card" "h-org")
+ :properties {:name ("Example")}})
:rels {}}
(parse "
Example
"))
-(expect {:items [{:type ["h-card"]
- :properties {:name '("John Doe")
- :org '({:value "Example"
- :type ["h-card" "h-org"]
- :properties {:name ("Example")}})}}]
+(expect {:items '({:type ("h-card")
+ :properties {:name ("John Doe")
+ :org ({:value "Example"
+ :type ("h-card" "h-org")
+ :properties {:name ("Example")}})}})
:rels {}}
(parse "
John Doe
--
cgit 1.4.1