Description:
Add tests (and bug fix as a result of a test).
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
@@ -4,7 +4,7 | |||
|
4 | 4 | (:require [clojure.java.shell :as shell] |
|
5 | 5 | [clojure.string :as string])) |
|
6 | 6 | |
|
7 | (defn get-extension [path] (re-find #"\.[a-zA-Z]+" path)) | |
|
7 | (defn get-extension [path] (re-find #"\.[a-zA-Z]+$" path)) | |
|
8 | 8 | |
|
9 | 9 | (defn gather-project-info |
|
10 | 10 | "Creates a dictionary of project information" |
@@ -38,7 +38,7 | |||
|
38 | 38 | |
|
39 | 39 | (defn check-readme [project] |
|
40 | 40 | (let [{files :files } project] |
|
41 | (boolean (some #{"README.md" "README.txt" "README.mkd"} files)) )) | |
|
41 | (boolean (some #{"README.md" "README.txt" "README.mkd" "README"} files)) )) | |
|
42 | 42 | |
|
43 | 43 | (defn check-untracked [project] |
|
44 | 44 | (let [{untracked :untracked-files } project] |
@@ -50,8 +50,7 | |||
|
50 | 50 | (some #{"TODO" "TODO.txt" } files)))) |
|
51 | 51 | |
|
52 | 52 | (defn check-readme-placeholders [project] |
|
53 | (= (count (re-find #"(FIXME|TODO)" (:readme project) )) 0) | |
|
54 | ) | |
|
53 | (= (count (re-find #"(FIXME|TODO)" (:readme project) )) 0)) | |
|
55 | 54 | |
|
56 | 55 | |
|
57 | 56 | (def checks [{:name "Has VCS" |
@@ -2,6 +2,43 | |||
|
2 | 2 | (:require [clojure.test :refer :all] |
|
3 | 3 | [project-checkup.core :refer :all])) |
|
4 | 4 | |
|
5 | (deftest a-test | |
|
6 | (testing "FIXME, I fail." | |
|
7 | (is (= 0 1)))) | |
|
5 | ||
|
6 | ||
|
7 | (deftest test-check-vcs | |
|
8 | (testing "Ensure the check works." | |
|
9 | (is | |
|
10 | (check-vcs {:files [".git"]}) ) | |
|
11 | (is | |
|
12 | (check-vcs {:files [".hg"]}) ) | |
|
13 | (is | |
|
14 | (not (check-vcs {:files []})) ) | |
|
15 | (is ;various almost-correct entries | |
|
16 | (not (check-vcs {:files ["hg" "git" "."]})) ))) | |
|
17 | ||
|
18 | ||
|
19 | (deftest test-check-readme | |
|
20 | (testing "Ensure READMEs are found correctly." | |
|
21 | (is | |
|
22 | (check-readme {:files ["README.md"]}))) | |
|
23 | (testing "Ensure no false positives" | |
|
24 | (is | |
|
25 | (not (check-readme {:files ["readme.exe"]}))) | |
|
26 | (is | |
|
27 | (not (check-readme {:files []}))))) | |
|
28 | ||
|
29 | (deftest test-check-untracked | |
|
30 | (testing "Ensure empty returns true" | |
|
31 | (is (check-untracked {:untracked-files []})) | |
|
32 | ) | |
|
33 | (testing "Ensure non-empty returns false" | |
|
34 | (is (not (check-untracked {:untracked-files [".hg"]}))))) | |
|
35 | ||
|
36 | ||
|
37 | (deftest test-get-extension | |
|
38 | (testing "test various paths with extensions" | |
|
39 | (is (= (get-extension "test.txt") ".txt")) | |
|
40 | (is (= (get-extension "./test.txt") ".txt")) | |
|
41 | (is (= (get-extension "test.txt.bak") ".bak")) | |
|
42 | (is (= (get-extension ".hg/test.txt.bak") ".bak")) | |
|
43 | ) | |
|
44 | ) |
You need to be logged in to leave comments.
Login now