summaryrefslogtreecommitdiffstats
path: root/unit-tests.sh
diff options
context:
space:
mode:
authorMichael Allen <michael@michaelallen.io>2015-02-12 00:07:07 +0000
committerMichael Allen <michael@michaelallen.io>2015-02-12 00:07:07 +0000
commit8d7c08e7f0d1fd880345cf4c62b0568e509ce13a (patch)
tree87d3f4f3e51469c92eaf228d1a6a3551ac13e39d /unit-tests.sh
parent0eeb5677650dc35ce3e3bef77b6a9a3154d221d2 (diff)
downloadgit-sonar-8d7c08e7f0d1fd880345cf4c62b0568e509ce13a.tar.gz
git-sonar-8d7c08e7f0d1fd880345cf4c62b0568e509ce13a.zip
separate tests into modules
Diffstat (limited to 'unit-tests.sh')
-rwxr-xr-xunit-tests.sh76
1 files changed, 0 insertions, 76 deletions
diff --git a/unit-tests.sh b/unit-tests.sh
deleted file mode 100755
index adf8ea8..0000000
--- a/unit-tests.sh
+++ /dev/null
@@ -1,76 +0,0 @@
-scriptDir="$(cd "$(dirname "$0")"; pwd)"
-
-source "$scriptDir/git-base.sh"
-
-tmpfile=""
-
-cd_to_tmp() {
- tmpfile="/tmp/git-prompt-tests-$(time_now)"
- mkdir -p "$tmpfile"
- cd "$tmpfile"
-}
-
-rm_tmp() {
- cd $scriptDir
- rm -r "$tmpfile"
-}
-
-test_git_root_in_repo() {
- cd $scriptDir
- local root="$(git_root)"
- assertEquals "$scriptDir" "$root"
-}
-
-test_git_root_not_in_repo() {
- cd_to_tmp
- local root="$(git_root)"
- assertEquals "" "$root"
- rm_tmp
-}
-
-test_dot_git_location_not_in_repo() {
- cd_to_tmp
- local filePath="$(dot_git)"
- assertEquals "" "$filePath"
- rm_tmp
-}
-
-test_dot_git_location_in_repo() {
- cd $scriptDir
- local filePath="$(dot_git)"
- local expected=".git"
- assertEquals "$expected" "$filePath"
-}
-
-test_is_repo_not_in_repo() {
- cd_to_tmp
- assertFalse is_repo
- rm_tmp
-}
-
-test_is_repo_in_repo() {
- cd $scriptDir
- assertTrue is_repo
-}
-
-test_record_timestamp_in_repo() {
- cd $scriptDir
- record_timestamp
- local timestamp="$(timestamp)"
- local timenow="$(time_now)"
- assertSame "$timenow" "$timestamp"
-}
-
-test_time_to_update_when_timestamp_is_old() {
- cd $scriptDir
- touch -A "-010000" "$(dot_git)/lastupdatetime"
- assertTrue time_to_update
-}
-
-test_not_time_to_update_when_just_recorded() {
- cd $scriptDir
- record_timestamp
- assertFalse time_to_update
-}
-
-. ./shunit/shunit2