Skip to content

Commit

Permalink
Improve AnswerInvalidationCheck by ignoring code indentation changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Zomis committed Sep 9, 2015
1 parent 48c034b commit 09bfb4b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Expand Up @@ -516,6 +516,13 @@ class AnswerInvalidationTest {
assert !changed
}
@Test
public void testIndentationChange() {
String a = '''<code>0\\na\\nb\\nc\\nd</code>'''
String b = '''<code>0\\n a\\n b\\n c\\nd</code>'''
assert AnswerInvalidationCheck.stripNonCode(a) == AnswerInvalidationCheck.stripNonCode(b)
}
@Test
public void testCodeBackticksChanged() {
Expand Down
Expand Up @@ -55,6 +55,7 @@ class AnswerInvalidationCheck {
}

static String stripNonCode(String post) {
post = post.replaceAll('[\\t ]', '')
int keepCount = 0
int index = post.indexOf('<code>')
while (index >= 0) {
Expand Down

0 comments on commit 09bfb4b

Please sign in to comment.