forked from bleis-tift/Git-Hooks
-
Notifications
You must be signed in to change notification settings - Fork 2
/
test_commit-msg.sh
executable file
·44 lines (35 loc) · 1.28 KB
/
test_commit-msg.sh
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
#! /bin/sh
test_commitmsg()
{
git checkout master >/dev/null 2>&1
echo hoge > test4commitmsg
./commit-msg test4commitmsg
assertEquals "hoge" "$(cat test4commitmsg)"
git checkout -b "id/42" >/dev/null 2>&1
./commit-msg test4commitmsg
assertEquals "hoge refs 42" "$(cat test4commitmsg)"
git checkout -b "bug/id/41" >/dev/null 2>&1
echo hoge > test4commitmsg
./commit-msg test4commitmsg
assertEquals "hoge refs 41" "$(cat test4commitmsg)"
git checkout -b "id/40" >/dev/null 2>&1
echo "hoge refs 40" > test4commitmsg
./commit-msg test4commitmsg
assertEquals "hoge refs 40" "$(cat test4commitmsg)"
git checkout -b "id/10/aaa" >/dev/null 2>&1
echo hoge > test4commitmsg
./commit-msg test4commitmsg
assertEquals "hoge refs 10" "$(cat test4commitmsg)"
git checkout -b "a/id/0/b" >/dev/null 2>&1
echo hoge > test4commitmsg
./commit-msg test4commitmsg
assertEquals "hoge refs 0" "$(cat test4commitmsg)"
git checkout master >/dev/null 2>&1
git branch -D "id/42" >/dev/null 2>&1
git branch -D "bug/id/41" >/dev/null 2>&1
git branch -D "id/40" >/dev/null 2>&1
git branch -D "id/10/aaa" >/dev/null 2>&1
git branch -D "a/id/0/b" >/dev/null 2>&1
rm test4commitmsg
}
. ./shunit2/src/shell/shunit2