Issue #2161: unify test input locations for grammars package
This commit is contained in:
parent
2fe5ade8b3
commit
ab6b9b8330
|
|
@ -19,6 +19,9 @@
|
|||
|
||||
package com.puppycrawl.tools.checkstyle.grammars;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.junit.Test;
|
||||
|
||||
|
|
@ -32,12 +35,17 @@ import com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck;
|
|||
*/
|
||||
public class EmbeddedNullCharTest
|
||||
extends BaseCheckTestSupport {
|
||||
@Override
|
||||
protected String getPath(String filename) throws IOException {
|
||||
return super.getPath("grammars" + File.separator + filename);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCanParse()
|
||||
throws Exception {
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(MemberNameCheck.class);
|
||||
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
|
||||
verify(checkConfig, getPath("grammars/InputEmbeddedNullChar.java"), expected);
|
||||
verify(checkConfig, getPath("InputEmbeddedNullChar.java"), expected);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.puppycrawl.tools.checkstyle.grammars;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.SystemUtils;
|
||||
|
|
@ -17,6 +18,16 @@ import com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck;
|
|||
*/
|
||||
public class GeneratedJava14LexerTest
|
||||
extends BaseCheckTestSupport {
|
||||
@Override
|
||||
protected String getPath(String filename) throws IOException {
|
||||
return super.getPath("grammars" + File.separator + filename);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getNonCompilablePath(String filename) throws IOException {
|
||||
return super.getNonCompilablePath("grammars" + File.separator + filename);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnexpectedChar() throws Exception {
|
||||
Assume.assumeFalse(SystemUtils.IS_OS_WINDOWS); // Encoding problems can occur in Windows
|
||||
|
|
@ -25,7 +36,7 @@ public class GeneratedJava14LexerTest
|
|||
final String[] expected = {
|
||||
"7:9: Name 'ÃЯ' must match pattern '^[a-z][a-zA-Z0-9]*$'.",
|
||||
};
|
||||
verify(checkConfig, getPath("grammars/InputGrammar.java"), expected);
|
||||
verify(checkConfig, getPath("InputGrammar.java"), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -33,7 +44,6 @@ public class GeneratedJava14LexerTest
|
|||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(MemberNameCheck.class);
|
||||
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
|
||||
verify(checkConfig, new File("src/test/resources-noncompilable/com/puppycrawl/tools/"
|
||||
+ "checkstyle/grammars/SemicolonBetweenImports.java").getCanonicalPath(), expected);
|
||||
verify(checkConfig, getNonCompilablePath("SemicolonBetweenImports.java"), expected);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,9 @@
|
|||
|
||||
package com.puppycrawl.tools.checkstyle.grammars;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.junit.Test;
|
||||
|
||||
|
|
@ -32,12 +35,17 @@ import com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck;
|
|||
*/
|
||||
public class HexFloatsTest
|
||||
extends BaseCheckTestSupport {
|
||||
@Override
|
||||
protected String getPath(String filename) throws IOException {
|
||||
return super.getPath("grammars" + File.separator + filename);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCanParse()
|
||||
throws Exception {
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(MemberNameCheck.class);
|
||||
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
|
||||
verify(checkConfig, getPath("grammars/InputHexFloat.java"), expected);
|
||||
verify(checkConfig, getPath("InputHexFloat.java"), expected);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,9 @@
|
|||
|
||||
package com.puppycrawl.tools.checkstyle.grammars;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.junit.Test;
|
||||
|
||||
|
|
@ -32,12 +35,17 @@ import com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck;
|
|||
*/
|
||||
public class Java7DiamondTest
|
||||
extends BaseCheckTestSupport {
|
||||
@Override
|
||||
protected String getPath(String filename) throws IOException {
|
||||
return super.getPath("grammars" + File.separator + filename);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCanParse()
|
||||
throws Exception {
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(MemberNameCheck.class);
|
||||
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
|
||||
verify(checkConfig, getPath("grammars/InputJava7Diamond.java"), expected);
|
||||
verify(checkConfig, getPath("InputJava7Diamond.java"), expected);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,9 @@
|
|||
|
||||
package com.puppycrawl.tools.checkstyle.grammars;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.junit.Test;
|
||||
|
||||
|
|
@ -32,12 +35,17 @@ import com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck;
|
|||
*/
|
||||
public class Java7MultiCatchTest
|
||||
extends BaseCheckTestSupport {
|
||||
@Override
|
||||
protected String getPath(String filename) throws IOException {
|
||||
return super.getPath("grammars" + File.separator + filename);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCanParse()
|
||||
throws Exception {
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(MemberNameCheck.class);
|
||||
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
|
||||
verify(checkConfig, getPath("grammars/InputJava7MultiCatch.java"), expected);
|
||||
verify(checkConfig, getPath("InputJava7MultiCatch.java"), expected);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,9 @@
|
|||
|
||||
package com.puppycrawl.tools.checkstyle.grammars;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.junit.Test;
|
||||
|
||||
|
|
@ -32,12 +35,17 @@ import com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck;
|
|||
*/
|
||||
public class Java7NumericalLiteralsTest
|
||||
extends BaseCheckTestSupport {
|
||||
@Override
|
||||
protected String getPath(String filename) throws IOException {
|
||||
return super.getPath("grammars" + File.separator + filename);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCanParse()
|
||||
throws Exception {
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(MemberNameCheck.class);
|
||||
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
|
||||
verify(checkConfig, getPath("grammars/InputJava7NumericalLiterals.java"), expected);
|
||||
verify(checkConfig, getPath("InputJava7NumericalLiterals.java"), expected);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,9 @@
|
|||
|
||||
package com.puppycrawl.tools.checkstyle.grammars;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.junit.Test;
|
||||
|
||||
|
|
@ -32,12 +35,17 @@ import com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck;
|
|||
*/
|
||||
public class Java7StringSwitchTest
|
||||
extends BaseCheckTestSupport {
|
||||
@Override
|
||||
protected String getPath(String filename) throws IOException {
|
||||
return super.getPath("grammars" + File.separator + filename);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCanParse()
|
||||
throws Exception {
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(MemberNameCheck.class);
|
||||
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
|
||||
verify(checkConfig, getPath("grammars/InputJava7StringSwitch.java"), expected);
|
||||
verify(checkConfig, getPath("InputJava7StringSwitch.java"), expected);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,9 @@
|
|||
|
||||
package com.puppycrawl.tools.checkstyle.grammars;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.junit.Test;
|
||||
|
||||
|
|
@ -32,12 +35,17 @@ import com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck;
|
|||
*/
|
||||
public class Java7TryWithResourcesTest
|
||||
extends BaseCheckTestSupport {
|
||||
@Override
|
||||
protected String getPath(String filename) throws IOException {
|
||||
return super.getPath("grammars" + File.separator + filename);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCanParse()
|
||||
throws Exception {
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(MemberNameCheck.class);
|
||||
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
|
||||
verify(checkConfig, getPath("grammars/InputJava7TryWithResources.java"), expected);
|
||||
verify(checkConfig, getPath("InputJava7TryWithResources.java"), expected);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,9 @@
|
|||
|
||||
package com.puppycrawl.tools.checkstyle.grammars;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.junit.Test;
|
||||
|
||||
|
|
@ -34,13 +37,18 @@ import com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck;
|
|||
*/
|
||||
public class LineCommentAtTheEndOfFileTest
|
||||
extends BaseCheckTestSupport {
|
||||
@Override
|
||||
protected String getPath(String filename) throws IOException {
|
||||
return super.getPath("grammars" + File.separator + filename);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCanParse()
|
||||
throws Exception {
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(MemberNameCheck.class);
|
||||
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
|
||||
verify(checkConfig, getPath("grammars/LineCommentAtTheEndOfFile.java"),
|
||||
verify(checkConfig, getPath("LineCommentAtTheEndOfFile.java"),
|
||||
expected);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,9 @@
|
|||
|
||||
package com.puppycrawl.tools.checkstyle.grammars;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.junit.Test;
|
||||
|
||||
|
|
@ -28,6 +31,11 @@ import com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck;
|
|||
|
||||
public class MultiDimensionalArraysInGenericsTest
|
||||
extends BaseCheckTestSupport {
|
||||
@Override
|
||||
protected String getPath(String filename) throws IOException {
|
||||
return super.getPath("grammars" + File.separator + filename);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCanParse()
|
||||
throws Exception {
|
||||
|
|
@ -35,7 +43,7 @@ public class MultiDimensionalArraysInGenericsTest
|
|||
createCheckConfig(MemberNameCheck.class);
|
||||
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
|
||||
verify(checkConfig,
|
||||
getPath("grammars/MultiDimensionalArraysInGenericsTestInput.java"),
|
||||
getPath("MultiDimensionalArraysInGenericsTestInput.java"),
|
||||
expected);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,9 @@
|
|||
|
||||
package com.puppycrawl.tools.checkstyle.grammars;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.junit.Test;
|
||||
|
||||
|
|
@ -32,12 +35,17 @@ import com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck;
|
|||
*/
|
||||
public class UnicodeEscapeTest
|
||||
extends BaseCheckTestSupport {
|
||||
@Override
|
||||
protected String getPath(String filename) throws IOException {
|
||||
return super.getPath("grammars" + File.separator + filename);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCanParse()
|
||||
throws Exception {
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(MemberNameCheck.class);
|
||||
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
|
||||
verify(checkConfig, getPath("grammars/UnicodeEscape.java"), expected);
|
||||
verify(checkConfig, getPath("UnicodeEscape.java"), expected);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,9 @@
|
|||
|
||||
package com.puppycrawl.tools.checkstyle.grammars;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.junit.Test;
|
||||
|
||||
|
|
@ -32,12 +35,17 @@ import com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck;
|
|||
*/
|
||||
public class VarargTest
|
||||
extends BaseCheckTestSupport {
|
||||
@Override
|
||||
protected String getPath(String filename) throws IOException {
|
||||
return super.getPath("grammars" + File.separator + filename);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCanParse()
|
||||
throws Exception {
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(MemberNameCheck.class);
|
||||
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
|
||||
verify(checkConfig, getPath("grammars/InputVararg.java"), expected);
|
||||
verify(checkConfig, getPath("InputVararg.java"), expected);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue