diff options
author | Malfurious <m@lfurio.us> | 2021-08-23 07:35:24 -0400 |
---|---|---|
committer | Malfurious <m@lfurio.us> | 2021-08-23 07:35:24 -0400 |
commit | 0175c1c40f9567a401a986d85ab6d6f5365eec7a (patch) | |
tree | 6e631a29735ab0c5ca0f1650934da3a24eecff62 /test/test-directories.sh | |
parent | 6c08d333a74aacd1fa9d14de9abab38ede4a8e88 (diff) | |
download | git-sonar-0175c1c40f9567a401a986d85ab6d6f5365eec7a.tar.gz git-sonar-0175c1c40f9567a401a986d85ab6d6f5365eec7a.zip |
Remove unit tests
I don't particularly wish to maintain these tests for a few reasons:
* Many of them make assertions strictly about rendered text / UI
* Many of them test external systems and touch the disk
* There are platform-dependent details that complicate several
tests.
So, the tests are removed. Ideally, the main script is reworked into
something simple enough it doesn't necessarily warrant heavy testing.
Signed-off-by: Malfurious <m@lfurio.us>
Diffstat (limited to '')
-rwxr-xr-x | test/test-directories.sh | 95 |
1 files changed, 0 insertions, 95 deletions
diff --git a/test/test-directories.sh b/test/test-directories.sh deleted file mode 100755 index d440072..0000000 --- a/test/test-directories.sh +++ /dev/null @@ -1,95 +0,0 @@ -#!/bin/bash -scriptDir="$(cd "$(dirname "$0")"; pwd)" - -source "$scriptDir/sonar-base.sh" - -tmpfile="" - -cd_to_tmp() { - tmpfile="/tmp/git-prompt-tests-$(time_now)" - mkdir -p "$tmpfile" - cd "$tmpfile" -} - -rm_tmp() { - cd $scriptDir - rm -rf /tmp/git-prompt-tests* -} - -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 - FETCH_TIME="$((5 * 60))" # Fetch every 5 mins - if [[ $OSTYPE == darwin* ]];then - touch -A "-010000" "$(dot_git)/lastupdatetime" - else - newtimestamp=$(date -d "now -1 hour" +%Y%m%d%H%M) - touch -t $newtimestamp "$(dot_git)/lastupdatetime" - fi; - assertTrue time_to_update -} - -test_not_time_to_update_when_just_recorded() { - cd $scriptDir - FETCH_TIME="$((5 * 60))" # Fetch every 5 mins - record_timestamp - assertFalse time_to_update -} - -test_time_to_update_when_no_timestamp() { - cd_to_tmp - git init --quiet - - FETCH_TIME="$((5 * 60))" # Fetch every 5 mins - time_to_update - assertTrue time_to_update - - rm_tmp -} - -. ./shunit/shunit2 |