groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sh...@apache.org
Subject groovy git commit: GROOVY-7717 StaticTypeCheckingTestCase#shouldFailWithMessages erroneously passes *StaticTypeCheckingTestCase: shouldFailWithMessages should only pass if all and only the expected error messages occur *PrecompiledExtensionNotExtendingDS
Date Mon, 21 Dec 2015 13:46:58 GMT
Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_4_X 71b68dd98 -> 3c1f7d0e0


GROOVY-7717 StaticTypeCheckingTestCase#shouldFailWithMessages erroneously passes
*StaticTypeCheckingTestCase: shouldFailWithMessages should only pass if all and only the expected
error messages occur
*PrecompiledExtensionNotExtendingDSL:  fix ASTNode associated with error added in onMethodSelection
method
(closes #217)


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/3c1f7d0e
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/3c1f7d0e
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/3c1f7d0e

Branch: refs/heads/GROOVY_2_4_X
Commit: 3c1f7d0e0f446e0cf240819a7a1595e3bd6f27c3
Parents: 71b68dd
Author: Shil Sinha <shils@apache.org>
Authored: Sun Dec 20 22:58:55 2015 -0500
Committer: Shil Sinha <shils@apache.org>
Committed: Mon Dec 21 08:42:00 2015 -0500

----------------------------------------------------------------------
 .../stc/PrecompiledExtensionNotExtendingDSL.groovy          | 2 +-
 .../groovy/transform/stc/StaticTypeCheckingTestCase.groovy  | 9 ++++-----
 2 files changed, 5 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/3c1f7d0e/src/test/groovy/transform/stc/PrecompiledExtensionNotExtendingDSL.groovy
----------------------------------------------------------------------
diff --git a/src/test/groovy/transform/stc/PrecompiledExtensionNotExtendingDSL.groovy b/src/test/groovy/transform/stc/PrecompiledExtensionNotExtendingDSL.groovy
index a6fade0..020304b 100644
--- a/src/test/groovy/transform/stc/PrecompiledExtensionNotExtendingDSL.groovy
+++ b/src/test/groovy/transform/stc/PrecompiledExtensionNotExtendingDSL.groovy
@@ -39,7 +39,7 @@ class PrecompiledExtensionNotExtendingDSL extends AbstractTypeCheckingExtension
     @Override
     void onMethodSelection(final Expression expression, final MethodNode target) {
         if (target.name=='println') {
-            addStaticTypeError('Error thrown from extension in onMethodSelection', expression.parameters[0])
+            addStaticTypeError('Error thrown from extension in onMethodSelection', expression.arguments[0])
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/groovy/blob/3c1f7d0e/src/test/groovy/transform/stc/StaticTypeCheckingTestCase.groovy
----------------------------------------------------------------------
diff --git a/src/test/groovy/transform/stc/StaticTypeCheckingTestCase.groovy b/src/test/groovy/transform/stc/StaticTypeCheckingTestCase.groovy
index 3e267c4..e42600a 100644
--- a/src/test/groovy/transform/stc/StaticTypeCheckingTestCase.groovy
+++ b/src/test/groovy/transform/stc/StaticTypeCheckingTestCase.groovy
@@ -78,14 +78,13 @@ abstract class StaticTypeCheckingTestCase extends GroovyTestCase {
         try {
             shell.evaluate(code, getTestClassName())
         } catch (MultipleCompilationErrorsException mce) {
-            mce.errorCollector.errors.each {
-                messages.each { message ->
-                    success = success || (it instanceof SyntaxErrorMessage && it.cause.message.contains(message))
+            success = messages.every { message ->
+                mce.errorCollector.errors.any {
+                    it instanceof SyntaxErrorMessage && it.cause.message.contains(message)
                 }
             }
-            if (!success) throw mce;
             if (success && mce.errorCollector.errorCount!=messages.length) {
-                throw new AssertionError("Expected error message was found, but compiler
thrown more than one error : "+mce.toString())
+                throw new AssertionError("Expected error messages were found, but compiler
threw additional errors : " + mce.toString())
             }
         }
         if (!success) throw new AssertionError("Test should have failed with messages [$messages]")


Mime
View raw message