Permalink
Browse files

Start adding midje tests

  • Loading branch information...
1 parent 9f4edd6 commit 125b2fee8bc40ed70cdfeb01c2e774eaf0f52bf7 @joeyates committed Jan 15, 2014
Showing with 22 additions and 8 deletions.
  1. +1 −0 project.clj
  2. +1 −1 src/sloccount/files.clj
  3. +0 −7 test/sloccount/core_test.clj
  4. +20 −0 test/sloccount/files_test.clj
View
@@ -4,4 +4,5 @@
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.5.1"]]
+ :profiles {:dev {:dependencies [[midje "1.5.1"]]}}
:main sloccount.core)
View
@@ -18,7 +18,7 @@
;; File selection
(defn version-control? [filename]
- (re-find #"\W(\.git|\.svn)\W" filename))
+ (re-find #"(^|/)(\.git|\.svn)/" filename))
(defn settings? [filename]
(re-find #"/(\.htaccess|\.gitignore)$" filename))
(defn binary? [filename]
@@ -1,7 +0,0 @@
-(ns sloccount.core-test
- (:require [clojure.test :refer :all]
- [sloccount.core :refer :all]))
-
-(deftest a-test
- (testing "FIXME, I fail."
- (is (= 0 1))))
@@ -0,0 +1,20 @@
+(ns sloccount.files-test
+ (:use midje.sweet)
+ (:require [sloccount.files :as files]))
+
+(facts "about `source-files`"
+ (fact "it returns files in the path"
+ (files/source-files "path") => ["foo"]
+ (provided (files/filenames "path") => ["foo"]))
+
+ (fact "it excludes files in the .git directory"
+ (files/source-files "path") => ["foo"]
+ (provided (files/filenames "path") => [".git/bar" "/.git/baz" "foo"]))
+
+ (fact "it excludes .gitignore"
+ (files/source-files "path") => ["foo"]
+ (provided (files/filenames "path") => [".git/bar" "foo"]))
+
+ (fact "it excludes binary files"
+ (files/source-files "path") => ["foo"]
+ (provided (files/filenames "path") => ["text.doc" "foo"])))

0 comments on commit 125b2fe

Please sign in to comment.