-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest
executable file
·42 lines (32 loc) · 884 Bytes
/
test
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
#!/usr/bin/env bash
#
# All Contributions by Match Group
#
# Copyright © 2025 Tinder (Match Group, LLC)
#
# Licensed under the Match Group Modified 3-Clause BSD License.
# See https://github.com/Tinder/Commit-Message-Validation-Hook/blob/main/LICENSE for license information.
#
./commit-msg "examples/00-ok" >/dev/null
if [ $? -ne 0 ]
then
echo "FAIL: \`./commit-msg examples/00-ok\` should exit with code 0"
exit 1
fi
for INDEX in 01 02 03 04 05 06
do
ACTUAL=$(./commit-msg "examples/$INDEX-message" 2>&1)
if [ $? -ne 1 ]
then
echo "FAIL: \`./commit-msg \"examples/$INDEX-message\" 2>&1\` should exit with code 1"
exit 1
fi
EXPECTED=$(cat "examples/$INDEX-validation")
if ! [ "$ACTUAL" = "$EXPECTED" ]
then
echo "FAIL: \`./commit-msg \"examples/$INDEX-message\" 2>&1\` should should output:"
echo "$EXPECTED"
exit 1
fi
done
echo "All Tests Passed"