Commits

Miki Tebeka committed c26f52f

Starting with feedparser tests

  • Participants
  • Parent commits 3c3edb6

Comments (0)

Files changed (1)

File test/feedparser_test.clj

+(import 'java.io.File)
+(require 'feedme)
+
+(defn file? [f]
+  (.isFile f))
+
+(defn abs-path [f]
+  (.getAbsolutePath f))
+
+(defn walk-tree [files]
+  (when-first [file files]
+    (if (file? file)
+      (lazy-cat (list file) (walk-tree (rest files)))
+      (lazy-cat (walk-tree (.listFiles file))
+                (walk-tree (rest files))))))
+
+(defn file-list [root]
+  (map abs-path (filter file? (walk-tree (.listFiles (new File root))))))
+
+(defn xml-files [root]
+  (filter #(.endsWith % ".xml") (file-list root)))
+
+(defn check []
+  (doseq [file (xml-files "test/feedparser/tests/wellformed/")]
+    (try
+      (feedme/parse (str "file://" file))
+    (catch Exception e (println file)))))