-
Notifications
You must be signed in to change notification settings - Fork 289
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #302 from commonmark/spec-test-case-separate
Make SpecTestCase not extend RenderingTestCase
- Loading branch information
Showing
7 changed files
with
43 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
commonmark-test-util/src/main/java/org/commonmark/testutil/Asserts.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.commonmark.testutil; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
public class Asserts { | ||
public static void assertRendering(String source, String expectedRendering, String actualRendering) { | ||
// include source for better assertion errors | ||
String expected = showTabs(expectedRendering + "\n\n" + source); | ||
String actual = showTabs(actualRendering + "\n\n" + source); | ||
assertEquals(expected, actual); | ||
} | ||
|
||
private static String showTabs(String s) { | ||
// Tabs are shown as "rightwards arrow" for easier comparison | ||
return s.replace("\t", "\u2192"); | ||
} | ||
} |
14 changes: 1 addition & 13 deletions
14
commonmark-test-util/src/main/java/org/commonmark/testutil/RenderingTestCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,10 @@ | ||
package org.commonmark.testutil; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
public abstract class RenderingTestCase { | ||
|
||
protected abstract String render(String source); | ||
|
||
protected void assertRendering(String source, String expectedResult) { | ||
String renderedContent = render(source); | ||
|
||
// include source for better assertion errors | ||
String expected = showTabs(expectedResult + "\n\n" + source); | ||
String actual = showTabs(renderedContent + "\n\n" + source); | ||
assertEquals(expected, actual); | ||
} | ||
|
||
private static String showTabs(String s) { | ||
// Tabs are shown as "rightwards arrow" for easier comparison | ||
return s.replace("\t", "\u2192"); | ||
Asserts.assertRendering(source, expectedResult, render(source)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters