aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorrnveach <rveach02@gmail.com>2016-05-29 08:41:49 -0400
committerRoman Ivanov <romani@users.noreply.github.com>2016-05-29 05:41:49 -0700
commit4c1d791973f9ecfdff9e9bbe0a539e7dcadfc761 (patch)
treeb0610934b15acaf8c38897b86f877880a03ddb1b /src/test
parent2dcc8ba90b0249eb759773cf0608eabbe613f516 (diff)
downloadcheckstyle-4c1d791973f9ecfdff9e9bbe0a539e7dcadfc761.tar.gz
Issue #3066: fixed line feeds in AstRegressionTest (#3228)
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/com/puppycrawl/tools/checkstyle/grammars/AstRegressionTest.java18
1 files changed, 3 insertions, 15 deletions
diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/AstRegressionTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/AstRegressionTest.java
index 6e022b02f..45bec8064 100644
--- a/src/test/java/com/puppycrawl/tools/checkstyle/grammars/AstRegressionTest.java
+++ b/src/test/java/com/puppycrawl/tools/checkstyle/grammars/AstRegressionTest.java
@@ -22,7 +22,6 @@ package com.puppycrawl.tools.checkstyle.grammars;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
import java.io.File;
import java.io.IOException;
@@ -146,19 +145,8 @@ public class AstRegressionTest extends BaseCheckTestSupport {
verifyAstRaw(getPath("InputRegressionEmptyAst.txt"), "// \r\n", true);
verifyAstRaw(getPath("InputRegressionEmptyAst.txt"), "/* \n */", true);
verifyAstRaw(getPath("InputRegressionEmptyAst.txt"), "/* \r\n */", true);
- // noinspection ProhibitedExceptionCaught
- try {
- verifyAstRaw(getPath("InputRegressionEmptyAst.txt"), "/* \r" + "\u0000\u0000" + " */",
- true);
- fail("Expected Exception");
- }
- catch (ArrayIndexOutOfBoundsException ex) {
- // expected, as 'FileContents.extractCComment' is confused if the
- // comment is a 1 line comment or 2. Part of FileContents thinks it
- // is 1 line while other parts think it is 2 lines. The exception
- // occurs when trying to retrieve the non-existent second line.
- assertEquals("expected exception", "1", ex.getMessage());
- }
+ verifyAstRaw(getPath("InputRegressionEmptyAst.txt"), "/* \r" + "\u0000\u0000" + " */",
+ true);
}
@Test
@@ -228,7 +216,7 @@ public class AstRegressionTest extends BaseCheckTestSupport {
"file.encoding", "UTF-8")).getFullText().toString().replace("\r", "");
final FileText actualFileContents = FileText.fromLines(new File(""),
- Arrays.asList(actualJava.split("\\n")));
+ Arrays.asList(actualJava.split("\\n|\\r\\n?")));
final String actualContents = AstTreeStringPrinter.printAst(actualFileContents,
withComments);