Show More
Commit Description:
Add tests (and bug fix as a result of a test).
Commit Description:
Add tests (and bug fix as a result of a test).
References:
File last commit:
Show/Diff file:
Action:
test/project_checkup/core_test.clj
44 lines | 1.2 KiB | text/x-clojure | ClojureLexer
44 lines | 1.2 KiB | text/x-clojure | ClojureLexer
r1 | (ns project-checkup.core-test | |||
(:require [clojure.test :refer :all] | ||||
[project-checkup.core :refer :all])) | ||||
r7 | ||||
(deftest test-check-vcs | ||||
(testing "Ensure the check works." | ||||
(is | ||||
(check-vcs {:files [".git"]}) ) | ||||
(is | ||||
(check-vcs {:files [".hg"]}) ) | ||||
(is | ||||
(not (check-vcs {:files []})) ) | ||||
(is ;various almost-correct entries | ||||
(not (check-vcs {:files ["hg" "git" "."]})) ))) | ||||
(deftest test-check-readme | ||||
(testing "Ensure READMEs are found correctly." | ||||
(is | ||||
(check-readme {:files ["README.md"]}))) | ||||
(testing "Ensure no false positives" | ||||
(is | ||||
(not (check-readme {:files ["readme.exe"]}))) | ||||
(is | ||||
(not (check-readme {:files []}))))) | ||||
(deftest test-check-untracked | ||||
(testing "Ensure empty returns true" | ||||
(is (check-untracked {:untracked-files []})) | ||||
) | ||||
(testing "Ensure non-empty returns false" | ||||
(is (not (check-untracked {:untracked-files [".hg"]}))))) | ||||
(deftest test-get-extension | ||||
(testing "test various paths with extensions" | ||||
(is (= (get-extension "test.txt") ".txt")) | ||||
(is (= (get-extension "./test.txt") ".txt")) | ||||
(is (= (get-extension "test.txt.bak") ".bak")) | ||||
(is (= (get-extension ".hg/test.txt.bak") ".bak")) | ||||
) | ||||
) | ||||