@@ -262,6 +262,36 @@ void generateWhenEscapedHtmlTagIsInIssueTitleItIsNotEscapedAgain() throws IOExce
262
262
assertThat (new String (Files .readAllBytes (file ))).contains ("Bug 1 for `<td>`" );
263
263
}
264
264
265
+ @ Test
266
+ void generateWhenMarkdownStylingIsInIssueTitleItIsEscaped () throws IOException {
267
+ setupGenerator (MilestoneReference .TITLE );
268
+ List <Issue > issues = new ArrayList <>();
269
+ issues .add (newIssue ("Bug 1 for *italic*" , "1" , "bug-1-url" , Type .BUG ));
270
+ issues .add (newIssue ("Bug 2 for _italic_" , "2" , "bug-2-url" , Type .BUG ));
271
+ issues .add (newIssue ("Bug 3 for **bold**" , "3" , "bug-3-url" , Type .BUG ));
272
+ issues .add (newIssue ("Bug 4 for __bold__" , "4" , "bug-4-url" , Type .BUG ));
273
+ issues .add (newIssue ("Bug 5 for ~strikethrough~" , "4" , "bug-4-url" , Type .BUG ));
274
+ given (this .service .getMilestoneNumber ("v2.3" , REPO )).willReturn (23 );
275
+ given (this .service .getIssuesForMilestone (23 , REPO )).willReturn (issues );
276
+ Path file = generateChangelog ("v2.3" );
277
+ assertThat (new String (Files .readAllBytes (file ))).contains ("Bug 1 for \\ *italic\\ *" );
278
+ assertThat (new String (Files .readAllBytes (file ))).contains ("Bug 2 for \\ _italic\\ _" );
279
+ assertThat (new String (Files .readAllBytes (file ))).contains ("Bug 3 for \\ *\\ *bold\\ *\\ *" );
280
+ assertThat (new String (Files .readAllBytes (file ))).contains ("Bug 4 for \\ _\\ _bold\\ _\\ _" );
281
+ assertThat (new String (Files .readAllBytes (file ))).contains ("Bug 5 for \\ ~strikethrough\\ ~" );
282
+ }
283
+
284
+ @ Test
285
+ void generateWhenEscapedMarkdownStylingIsInIssueTitleItIsNotEscapedAgain () throws IOException {
286
+ setupGenerator (MilestoneReference .TITLE );
287
+ List <Issue > issues = new ArrayList <>();
288
+ issues .add (newIssue ("Bug 1 for `<td>`" , "1" , "bug-1-url" , Type .BUG ));
289
+ given (this .service .getMilestoneNumber ("v2.3" , REPO )).willReturn (23 );
290
+ given (this .service .getIssuesForMilestone (23 , REPO )).willReturn (issues );
291
+ Path file = generateChangelog ("v2.3" );
292
+ assertThat (new String (Files .readAllBytes (file ))).contains ("Bug 1 for `<td>`" );
293
+ }
294
+
265
295
@ Test
266
296
void generateWhenSectionSortedByTitle () throws Exception {
267
297
List <Section > sections = new ArrayList <>();
0 commit comments