File tree Expand file tree Collapse file tree 2 files changed +65
-3
lines changed
Expand file tree Collapse file tree 2 files changed +65
-3
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ r_scope="(\([[:alnum:] \/-]+\))?"
2525# optional breaking change indicator and colon delimiter
2626r_delim=' !?:'
2727# subject line, body, footer
28- r_subject=" [[:alnum :]].+"
28+ r_subject=" [[:print :]].+"
2929# the full regex pattern
3030pattern=" ^$r_types$r_scope$r_delim$r_subject $"
3131
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ teardown () {
2727 rm -rf " $test_dir "
2828}
2929
30- # test a failure
30+ echo " test a failure"
3131
3232setup
3333
@@ -39,7 +39,9 @@ echo "$fail" | grep -Eq "Your commit message does not follow Conventional Commit
3939
4040(( result += "$? " ))
4141
42- # test a success
42+ echo " $result "
43+
44+ echo " test a success"
4345
4446setup
4547
@@ -51,4 +53,64 @@ echo "$pass" | grep -Eq "\[main \(root-commit\) [[:alnum:]]{7}\] test: conventio
5153
5254(( result += "$? " ))
5355
56+ echo " $result "
57+
58+ echo " test printable characters/marks in subject"
59+
60+ echo " test escaped double quote \" "
61+
62+ setup
63+
64+ pass=" $( git commit -m ' test: conventional-pre-commit "' ) "
65+
66+ teardown
67+
68+ echo " $pass " | grep -Eq " \[main \(root-commit\) [[:alnum:]]{7}\] test: conventional-pre-commit \" "
69+
70+ (( result += "$? " ))
71+
72+ echo " $result "
73+
74+ echo " test backtick \` "
75+
76+ setup
77+
78+ pass=" $( git commit -m ' test: conventional-pre-commit `' ) "
79+
80+ teardown
81+
82+ echo " $pass " | grep -Eq " \[main \(root-commit\) [[:alnum:]]{7}\] test: conventional-pre-commit \` "
83+
84+ (( result += "$? " ))
85+
86+ echo " $result "
87+
88+ echo " test hash/number sign #"
89+
90+ setup
91+
92+ pass=" $( git commit -m ' test: conventional-pre-commit #' ) "
93+
94+ teardown
95+
96+ echo " $pass " | grep -Eq " \[main \(root-commit\) [[:alnum:]]{7}\] test: conventional-pre-commit #"
97+
98+ (( result += "$? " ))
99+
100+ echo " $result "
101+
102+ echo " test ampersand &"
103+
104+ setup
105+
106+ pass=" $( git commit -m ' test: conventional-pre-commit &' ) "
107+
108+ teardown
109+
110+ echo " $pass " | grep -Eq " \[main \(root-commit\) [[:alnum:]]{7}\] test: conventional-pre-commit &"
111+
112+ (( result += "$? " ))
113+
114+ echo " $result "
115+
54116exit " $result "
You can’t perform that action at this time.
0 commit comments