Skip to content

Commit 4db8c11

Browse files
committed
test: special characters in commit message
1 parent ea2c4b5 commit 4db8c11

File tree

1 file changed

+52
-2
lines changed

1 file changed

+52
-2
lines changed

tests.sh

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ teardown () {
2727
rm -rf "$test_dir"
2828
}
2929

30-
# test a failure
30+
echo "test a failure"
3131

3232
setup
3333

@@ -39,7 +39,7 @@ echo "$fail" | grep -Eq "Your commit message does not follow Conventional Commit
3939

4040
(( result += "$?" ))
4141

42-
# test a success
42+
echo "test a success"
4343

4444
setup
4545

@@ -51,4 +51,54 @@ echo "$pass" | grep -Eq "\[main \(root-commit\) [[:alnum:]]{7}\] test: conventio
5151

5252
(( result += "$?" ))
5353

54+
echo "test printable characters/marks in subject"
55+
56+
echo "test escaped double quote \""
57+
58+
setup
59+
60+
pass="$(git commit -m 'test: conventional-pre-commit \"')"
61+
62+
teardown
63+
64+
echo "$pass" | grep -Eq "\[main \(root-commit\) [[:alnum:]]{7}\] test: conventional-pre-commit \""
65+
66+
(( result += "$?" ))
67+
68+
echo "test backtick \`"
69+
70+
setup
71+
72+
pass="$(git commit -m 'test: conventional-pre-commit \`')"
73+
74+
teardown
75+
76+
echo "$pass" | grep -Eq "\[main \(root-commit\) [[:alnum:]]{7}\] test: conventional-pre-commit \`"
77+
78+
(( result += "$?" ))
79+
80+
echo "test hash/number sign #"
81+
82+
setup
83+
84+
pass="$(git commit -m 'test: conventional-pre-commit #')"
85+
86+
teardown
87+
88+
echo "$pass" | grep -Eq "\[main \(root-commit\) [[:alnum:]]{7}\] test: conventional-pre-commit #"
89+
90+
(( result += "$?" ))
91+
92+
echo "test ampersand &"
93+
94+
setup
95+
96+
pass="$(git commit -m 'test: conventional-pre-commit &')"
97+
98+
teardown
99+
100+
echo "$pass" | grep -Eq "\[main \(root-commit\) [[:alnum:]]{7}\] test: conventional-pre-commit &"
101+
102+
(( result += "$?" ))
103+
54104
exit "$result"

0 commit comments

Comments
 (0)