diff --git a/build.hxml b/build.hxml index 21baea40..7e4ccb5a 100644 --- a/build.hxml +++ b/build.hxml @@ -17,6 +17,7 @@ --next -lib mcover:2.1.1 +-D unittest -x TestMain --macro mcover.MCover.coverage(['checkstyle'], ['src'], ['checkstyle.reporter', 'checkstyle.Main']) diff --git a/checkstyle.json b/checkstyle.json index 5a741f39..c1a07423 100644 --- a/checkstyle.json +++ b/checkstyle.json @@ -518,7 +518,8 @@ "checkstyle.Checker", "checkstyle.ChecksInfo", "checkstyle.checks.imports.UnusedImportCheck", - "TestMain" + "TestMain", + "misc.ExtensionsTest" ], "MultipleStringLiterals": [ "checks", diff --git a/src/checkstyle/Checker.hx b/src/checkstyle/Checker.hx index 50cbd4c1..643f5f01 100644 --- a/src/checkstyle/Checker.hx +++ b/src/checkstyle/Checker.hx @@ -125,6 +125,9 @@ class Checker { Sys.println(e); Sys.println("Stacktrace: " + CallStack.toString(CallStack.exceptionStack())); #end + #if unittest + throw e; + #end } } @@ -155,6 +158,9 @@ class Checker { Sys.println(e); Sys.println("Stacktrace: " + CallStack.toString(CallStack.exceptionStack())); #end + #if unittest + throw e; + #end } return null; } diff --git a/src/checkstyle/checks/Check.hx b/src/checkstyle/checks/Check.hx index c0e95659..215d0bfa 100644 --- a/src/checkstyle/checks/Check.hx +++ b/src/checkstyle/checks/Check.hx @@ -45,6 +45,9 @@ class Check { Sys.println(e); Sys.println("Stacktrace: " + CallStack.toString(CallStack.exceptionStack())); #end + #if unittest + throw e; + #end } } return messages; diff --git a/src/checkstyle/token/TokenTreeBuilder.hx b/src/checkstyle/token/TokenTreeBuilder.hx index b087e99d..b94f9fbe 100644 --- a/src/checkstyle/token/TokenTreeBuilder.hx +++ b/src/checkstyle/token/TokenTreeBuilder.hx @@ -333,7 +333,7 @@ class TokenTreeBuilder { if (stream.is(DblDot)) { var dblDot:TokenTree = stream.consumeTokenDef(DblDot); name.addChild(dblDot); - walkTypeNameDef(name); + walkTypeNameDef(dblDot); } walkBlock(name); } diff --git a/test/misc/ExtensionsTest.hx b/test/misc/ExtensionsTest.hx index bf5e1783..127edfcb 100644 --- a/test/misc/ExtensionsTest.hx +++ b/test/misc/ExtensionsTest.hx @@ -6,7 +6,15 @@ import checkstyle.checks.whitespace.IndentationCharacterCheck; class ExtensionsTest extends CheckTestCase { public function testExtensions() { - assertNoMsg(new IndentationCharacterCheck(), TEST1); + try { + assertNoMsg(new IndentationCharacterCheck(), TEST1); + // unless haxeparse bug is fixed, this code is unreachable + assertFalse(true); + } + catch (e:Dynamic) { + assertEquals("misc.ExtensionsTest", e.classname); + assertEquals("expected '' but was 'Parsing failed: Unexpected >", e.error.substr(0, 49)); + } } }