Skip to content
Browse files

Fixed raw creating invalid filenames under Windows.

  • Loading branch information...
JulianBirch committed May 6, 2010
1 parent a7ba0c0 commit 2eeb1fb2cac440974e90635609ea0be8616998d4
Showing with 13 additions and 5 deletions.
  1. +2 −1 src/circumspec/raw.clj
  2. +11 −4 test/circumspec/raw_test.clj
@@ -5,7 +5,8 @@
(defn dump-file
"Create dump file name for a test run"
(File. ".circumspec/raw/" (.toString (java.util.Date.))))
(File. (str ".circumspec/raw/" (.replace (.toString (java.util.Date.)) \: \_))))
; Replace colons with underscores for windows compatibility

(defn dump-results
"Spit results into a file, return instance."
@@ -1,15 +1,22 @@
(ns circumspec.raw-test
(:use circumspec circumspec.raw))
(:use circumspec circumspec.raw)

;; TODO: better filename convention
(describe dump-file
(it "creates a file in .circumspec/raw"
(let [file (dump-file)]
(let [file (dump-file)
separator (
escapedSeparator (if (= separator "\\") "\\\\" (str separator))
filePattern (str "[.]circumspec" escapedSeparator "raw" escapedSeparator ".*")
(should (instance? file))
(should (re-find #"\.circumspec/raw/.*" (.toString file))))))
(should (not (re-find #":" (.toString file))))
(should (re-find (re-pattern filePattern) (.toString file))))))

(describe dump-results
(it "writes complete restuls to a file"
(it "writes complete results to a file"
(let [file (dump-results (take 2 (repeat {:sample true})))]
(should (= "{:sample true}\n{:sample true}\n" (slurp (.toString file))))
(should (.delete file) "deleting sample result data"))))

0 comments on commit 2eeb1fb

Please sign in to comment.
You can’t perform that action at this time.