@@ -151,6 +151,73 @@ def test_strip_comments__spaced():
151151 assert result .strip () == "feat(scope): message"
152152
153153
154+ def test_r_verbose_diff__has_diff ():
155+ regex = re .compile (format .r_verbose_diff (), re .MULTILINE )
156+ input = """# ----------- >8 -----------
157+ # Some comment
158+ # Some comment
159+ diff --git a/file b/file
160+ """
161+
162+ assert regex .match (input )
163+
164+
165+ def test_r_verbose_diff__no_diff ():
166+ regex = re .compile (format .r_verbose_diff (), re .MULTILINE )
167+ input = """# ----------- >8 -----------
168+ # Some comment
169+ # Some comment
170+ """
171+
172+ assert not regex .match (input )
173+
174+
175+ def test_r_verbose_diff__no_extra_comments ():
176+ regex = re .compile (format .r_verbose_diff (), re .MULTILINE )
177+ input = """# ----------- >8 -----------
178+ diff --git a/file b/file
179+ """
180+
181+ assert not regex .match (input )
182+
183+
184+ def test_strip_verbose_diff__has_diff ():
185+ input = """feat(scope): message
186+ # Please enter the commit message for your changes.
187+
188+ # These are comments usually added by editors, f.ex. with export EDITOR=vim
189+ # ----------- >8 -----------
190+ # Some comment
191+ # Some comment
192+ diff --git a/file b/file
193+ """
194+
195+ result = format .strip_verbose_diff (input )
196+ assert result .count ("\n " ) == 4
197+ assert (
198+ result
199+ == """feat(scope): message
200+ # Please enter the commit message for your changes.
201+
202+ # These are comments usually added by editors, f.ex. with export EDITOR=vim
203+ """
204+ )
205+
206+
207+ def test_strip_verbose_diff__no_diff ():
208+ input = """feat(scope): message
209+ # Please enter the commit message for your changes.
210+
211+ # These are comments usually added by editors, f.ex. with export EDITOR=vim
212+ # ----------- >8 -----------
213+ # Some comment
214+ # Some comment
215+ """
216+
217+ result = format .strip_verbose_diff (input )
218+ assert result == input
219+
220+
154221@pytest .mark .parametrize ("type" , format .DEFAULT_TYPES )
155222def test_is_conventional__default_type (type ):
156223 input = f"{ type } : message"
0 commit comments