diff options
author | Malfurious <m@lfurio.us> | 2021-03-24 02:59:48 -0400 |
---|---|---|
committer | Malfurious <m@lfurio.us> | 2021-03-24 02:59:48 -0400 |
commit | a9737ee899dcfee46d8765c1b534b8c9df68cbe6 (patch) | |
tree | 2e0a68fbec1d86915e37c1db1c7768504f6e01e0 /test-files.sh | |
parent | fee615fe9fd3a535bd6dfd8fcf01c3dee9300b6c (diff) | |
parent | 51bd4bc64308f1eb8e1aab20d6f3280549098267 (diff) | |
download | git-sonar-a9737ee899dcfee46d8765c1b534b8c9df68cbe6.tar.gz git-sonar-a9737ee899dcfee46d8765c1b534b8c9df68cbe6.zip |
Merge branch 'hotfix/unittests' of https://github.com/cbandera/git-radar
Merge pending pull request #67 of upstream git-radar project from user
cbandera. They write:
This is a pull request to fix issue #38. As it turns out, some built in
commands behave differently on Mac OS X and Linux.
In order to run the tests on Linux, I have added switch statements at
some points to call the functions with the respective syntax.
Also I realized, that the tests only worked for me when I set the
following options:
git config --global push.default simple
git config --global branch.autosetuprebase never
But that's probably just because these should be the defaults. I
normally have them set to something else...
Diffstat (limited to 'test-files.sh')
-rwxr-xr-x | test-files.sh | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/test-files.sh b/test-files.sh index b27a18c..8b06732 100755 --- a/test-files.sh +++ b/test-files.sh @@ -1,3 +1,4 @@ +#!/bin/bash scriptDir="$(cd "$(dirname "$0")"; pwd)" source "$scriptDir/radar-base.sh" @@ -24,7 +25,7 @@ test_untracked_files() { touch foo assertEquals "1?" "$(untracked_status)" - git add . + git add --all assertEquals "" "$(untracked_status)" rm_tmp @@ -38,7 +39,7 @@ test_unstaged_modified_files() { touch foo touch bar - git add . + git add --all git commit -m "foo and bar" >/dev/null echo "foo" >> foo @@ -58,7 +59,7 @@ test_unstaged_deleted_files() { touch foo touch bar - git add . + git add --all git commit -m "foo and bar" >/dev/null rm foo @@ -77,11 +78,11 @@ test_staged_added_files() { assertEquals "" "$(staged_status)" touch foo - git add . + git add --all assertEquals "1A" "$(staged_status)" touch bar - git add . + git add --all assertEquals "2A" "$(staged_status)" rm_tmp @@ -95,15 +96,15 @@ test_staged_modified_files() { touch foo touch bar - git add . + git add --all git commit -m "foo and bar" >/dev/null echo "foo" >> foo - git add . + git add --all assertEquals "1M" "$(staged_status)" echo "bar" >> bar - git add . + git add --all assertEquals "2M" "$(staged_status)" rm_tmp @@ -117,15 +118,15 @@ test_staged_deleted_files() { touch foo touch bar - git add . + git add --all git commit -m "foo and bar" >/dev/null rm foo - git add . + git add --all assertEquals "1D" "$(staged_status)" rm bar - git add . + git add --all assertEquals "2D" "$(staged_status)" rm_tmp @@ -139,15 +140,15 @@ test_staged_renamed_files() { touch foo touch bar - git add . + git add --all git commit -m "foo and bar" >/dev/null mv foo foo2 - git add . + git add --all assertEquals "1R" "$(staged_status)" mv bar bar2 - git add . + git add --all assertEquals "2R" "$(staged_status)" rm_tmp @@ -159,17 +160,17 @@ test_conflicted_both_changes() { git checkout -b foo --quiet echo "foo" >> foo - git add . + git add --all git commit -m "foo" --quiet git checkout -b foo2 --quiet echo "bar" >> foo - git add . + git add --all git commit -m "bar" --quiet git checkout foo --quiet echo "foo2" >> foo - git add . + git add --all git commit -m "foo2" --quiet assertEquals "" "$(conflicted_status)" @@ -187,17 +188,17 @@ test_conflicted_them_changes() { git checkout -b foo --quiet echo "foo" >> foo - git add . + git add --all git commit -m "foo" --quiet git checkout -b foo2 --quiet rm foo - git add . + git add --all git commit -m "delete foo" --quiet git checkout foo --quiet echo "foo2" >> foo - git add . + git add --all git commit -m "foo2" --quiet assertEquals "" "$(conflicted_status)" @@ -215,17 +216,17 @@ test_conflicted_us_changes() { git checkout -b foo --quiet echo "foo" >> foo - git add . + git add --all git commit -m "foo" --quiet git checkout -b foo2 --quiet echo "bar" >> foo - git add . + git add --all git commit -m "bar" --quiet git checkout foo --quiet rm foo - git add . + git add --all git commit -m "delete foo" --quiet assertEquals "" "$(conflicted_status)" @@ -254,7 +255,7 @@ test_is_dirty() { cd ../ - git add . + git add --all assertTrue "staged addition files" is_dirty git commit -m "inital commit" --quiet @@ -264,7 +265,7 @@ test_is_dirty() { echo "foo" >> foo assertTrue "modified file unstaged" is_dirty - git add . + git add --all assertTrue "modified file staged" is_dirty rm_tmp |