blob: 33a65a1a403ff17bfecbfa0f76c6d76faf1581d2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
source $DIRNAME/spacefish_test_setup.fish
function setup
spacefish_test_setup
mkdir -p /tmp/tmp-spacefish
cd /tmp/tmp-spacefish
command git init >/dev/null
command git config --local user.email "test@example.com"
command git config --local user.name "Test User"
end
function teardown
rm -rf /tmp/tmp-spacefish
end
test "Identifies HEAD before initial commit"
(
echo "HEAD"
) = (__sf_util_git_branch)
end
test "Identifies master branch"
(
command git commit --allow-empty -m "initial commit" --quiet
echo "master"
) = (__sf_util_git_branch)
end
test "Identifies an alternate branch name"
(
command git checkout -b "testBranch" 2>/dev/null
command git commit --allow-empty -m "initial commit" --quiet
echo "testBranch"
) = (__sf_util_git_branch)
end
test "No result provided for non-git directory"
(
cd ~
echo ""
) = (__sf_util_git_branch)
end
|