Skip to content

Commit bfb893f

Browse files
committed
Some optimizations for the tests
1 parent c73381f commit bfb893f

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

‎transform-markup/src/test/java/org/ocpsoft/rewrite/transform/markup/MarkdownTest.java‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public void testHeaders() {
3838
String markdown = "# Header\n\n##Section\n\nSome text!";
3939
String html = new Markdown(false).transform(markdown);
4040

41-
assertEquals("<h1 id='header'>Header</h1><h2 id='section'>Section</h2><p>Some text!</p>", removeNewLines(html));
41+
assertEquals("<h1 id='header'>Header</h1><h2 id='section'>Section</h2><p>Some text!</p>", normalize(html));
4242

4343
}
4444

@@ -48,7 +48,7 @@ public void testBlockquote() {
4848
String markdown = "> Some quote";
4949
String html = new Markdown(false).transform(markdown);
5050

51-
assertEquals("<blockquote><p>Some quote</p></blockquote>", removeNewLines(html));
51+
assertEquals("<blockquote><p>Some quote</p></blockquote>", normalize(html));
5252

5353
}
5454

@@ -58,7 +58,7 @@ public void testLists() {
5858
String markdown = "* One\n* Two";
5959
String html = new Markdown(false).transform(markdown);
6060

61-
assertEquals("<ul><li>One</li><li>Two</li></ul>", removeNewLines(html));
61+
assertEquals("<ul><li>One</li><li>Two</li></ul>", normalize(html));
6262

6363
}
6464

@@ -68,7 +68,7 @@ public void testCode() {
6868
String markdown = " private int n = 0;";
6969
String html = new Markdown(false).transform(markdown);
7070

71-
assertEquals("<pre><code>private int n = 0;</code></pre>", removeNewLines(html));
71+
assertEquals("<pre><code>private int n = 0;</code></pre>", normalize(html));
7272

7373
}
7474

@@ -85,8 +85,8 @@ public void testFullHtmlDocument() {
8585

8686
}
8787

88-
private static String removeNewLines(String s) {
89-
return s.replaceAll("\n", "");
88+
private static String normalize(String s) {
89+
return s.replaceAll("\n", "").replaceAll("[\t ]+", " ").trim();
9090
}
9191

9292
}

‎transform-markup/src/test/java/org/ocpsoft/rewrite/transform/markup/SassTest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public void testMixins() {
6262
}
6363

6464
private static String normalize(String s) {
65-
return s.replaceAll("\n", " ").replaceAll(" +", " ").trim();
65+
return s.replaceAll("\n", "").replaceAll("[\t ]+", " ").trim();
6666
}
6767

6868
}

0 commit comments

Comments
 (0)