From 0175c1c40f9567a401a986d85ab6d6f5365eec7a Mon Sep 17 00:00:00 2001 From: Malfurious Date: Mon, 23 Aug 2021 07:35:24 -0400 Subject: 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 --- test/test-branches.sh | 110 -------------------------------------------------- 1 file changed, 110 deletions(-) delete mode 100755 test/test-branches.sh (limited to 'test/test-branches.sh') diff --git a/test/test-branches.sh b/test/test-branches.sh deleted file mode 100755 index ce779b3..0000000 --- a/test/test-branches.sh +++ /dev/null @@ -1,110 +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_branch_name_in_repo() { - cd_to_tmp - git init --quiet - git checkout -b foo --quiet - assertEquals "foo" "$(branch_name)" - - git checkout -b bar --quiet - assertEquals "bar" "$(branch_name)" - - git checkout -b baz --quiet - assertEquals "baz" "$(branch_name)" - - rm_tmp -} - -test_branch_name_not_in_repo() { - cd_to_tmp - assertEquals "" "$(branch_name)" - rm_tmp -} - -test_detached_from_branch() { - cd_to_tmp - git init --quiet - assertEquals "master" "$(branch_name)" - - touch README - git add . - git commit -m "initial commit" --quiet - - touch foo - git add . - git commit -m "foo" --quiet - - git checkout --quiet HEAD^ >/dev/null - sha="$(commit_short_sha)" - - assertNotEquals "master" "$(branch_name)" - assertEquals "$sha" "$(branch_ref)" - assertEquals "detached@$sha" "$(zsh_readable_branch_name)" - assertEquals "detached@$sha" "$(bash_readable_branch_name)" - assertEquals "detached@$sha" "$(readable_branch_name)" - - rm_tmp -} - -test_branch_name_returns_error() { - cd_to_tmp - git init --quiet - - touch README - git add . - git commit -m "initial commit" --quiet - - touch foo - git add . - git commit -m "foo" --quiet - - git checkout --quiet HEAD^ >/dev/null - - retcode="$(branch_name; echo $?)" - assertEquals "1" "$retcode" - rm_tmp -} - -test_remote_branch_name_quiet_when_not_in_repo() { - cd_to_tmp - - debug_output="$( - { - output="$( - remote_branch_name; - )" - } 2>&1 - echo "$output" - )" - - usages="$(echo "$debug_output" | grep -E "(usage|fatal):" | wc -l)" - - echo "$debug_output" - - if [[ $OSTYPE == darwin* ]];then - expected=" 0" - else - expected="0" - fi; - assertEquals "$expected" "$usages" - - rm_tmp -} - -. ./shunit/shunit2 -- cgit v1.2.3