Skip to content

Commit

Permalink
Start adding midje tests
Browse files Browse the repository at this point in the history
  • Loading branch information
joeyates committed Jan 15, 2014
1 parent 9f4edd6 commit 125b2fe
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
1 change: 1 addition & 0 deletions project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion src/sloccount/files.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
7 changes: 0 additions & 7 deletions test/sloccount/core_test.clj

This file was deleted.

20 changes: 20 additions & 0 deletions test/sloccount/files_test.clj
Original file line number Diff line number Diff line change
@@ -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.