Permalink
Browse files

Remove comments and shutdown agents for faster exits.

  • Loading branch information...
1 parent 703b03b commit a57ed715ea6d761c871211687d3b3cf0ac811c9a @mudge committed Mar 29, 2013
Showing with 12 additions and 5 deletions.
  1. +6 −4 src/foreclojure_downloader/core.clj
  2. +6 −1 src/foreclojure_downloader/translator.clj
@@ -5,12 +5,14 @@
(defn- problems
"All problems currently on 4clojure."
[]
- (filter identity (pmap api/problem (range 1 200))))
+ (filter identity (pmap api/problem (range 1 173))))
(defn -main
([] (-main "src/foreclojure_solutions"))
([path]
- (doseq [problem (problems)]
- (println "Writing problem" (:number problem) (:title problem))
- (writer/write-problem problem path))))
+ (do
+ (doseq [problem (problems)]
+ (println "Writing problem" (:number problem) (:title problem))
+ (writer/write-problem problem path))
+ (shutdown-agents))))
@@ -9,13 +9,18 @@
(next (re-find #"^(?s)\((==?)\s+(#?\".+\"|'?\(.+\)|\[.+\]|#?\{.+\}|\S+)\s+(#?\".+\"|'?\(.+\)|\[.+\]|#?\{.+\}|\S+)\)$"
test)))))
+(defn- remove-comments
+ "Naively remove trailing comments from the given test."
+ [test]
+ (string/replace test #"(?m)\s+;.+$" ""))
+
(defn- test->checker
"Translate a test into a Midje checker.
Tests of the form (= x y) will be translated to x => y but more complex tests
will be preserved and checked to be true, e.g. (and (= x y) (= z a)) => true"
[test]
- (let [indented-test (string/replace test "\r\n" "\n ")]
+ (let [indented-test (remove-comments (string/replace test "\r\n" "\n "))]
(if-let [[equals left right] (parse-simple-test indented-test)]
(str " " left " " equals "> " right)
(str " " indented-test " => true"))))

0 comments on commit a57ed71

Please sign in to comment.