From commits-return-9397-archive-asf-public=cust-asf.ponee.io@groovy.apache.org Mon Oct 21 02:18:46 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 98E5D180680 for ; Mon, 21 Oct 2019 04:18:45 +0200 (CEST) Received: (qmail 92998 invoked by uid 500); 21 Oct 2019 02:18:45 -0000 Mailing-List: contact commits-help@groovy.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@groovy.apache.org Delivered-To: mailing list commits@groovy.apache.org Received: (qmail 92876 invoked by uid 99); 21 Oct 2019 02:18:44 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Oct 2019 02:18:44 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 4619B80938; Mon, 21 Oct 2019 02:18:44 +0000 (UTC) Date: Mon, 21 Oct 2019 02:18:44 +0000 To: "commits@groovy.apache.org" Subject: [groovy] 01/04: minor refactor MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit From: sunlan@apache.org In-Reply-To: <157162432387.7160.12843734156700537034@gitbox.apache.org> References: <157162432387.7160.12843734156700537034@gitbox.apache.org> X-Git-Host: gitbox.apache.org X-Git-Repo: groovy X-Git-Refname: refs/heads/GROOVY_3_0_X X-Git-Reftype: branch X-Git-Rev: 020a7e77105fe77280d53eb013bcced7fe7daf20 X-Git-NotificationType: diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated Message-Id: <20191021021844.4619B80938@gitbox.apache.org> This is an automated email from the ASF dual-hosted git repository. sunlan pushed a commit to branch GROOVY_3_0_X in repository https://gitbox.apache.org/repos/asf/groovy.git commit 020a7e77105fe77280d53eb013bcced7fe7daf20 Author: Eric Milles AuthorDate: Fri Oct 18 10:21:50 2019 -0500 minor refactor (cherry picked from commit f105fc3b44f329d444b2c9db8775499329958329) --- src/test/groovy/bugs/Groovy9261.groovy | 37 ++++++++++++++-------- .../test/suite/ATestScriptThatsNoTestCase.groovy | 4 ++- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/src/test/groovy/bugs/Groovy9261.groovy b/src/test/groovy/bugs/Groovy9261.groovy index 347d5c7..1581eb9 100644 --- a/src/test/groovy/bugs/Groovy9261.groovy +++ b/src/test/groovy/bugs/Groovy9261.groovy @@ -18,11 +18,17 @@ */ package groovy.bugs -import groovy.test.GroovyTestCase +import groovy.transform.CompileStatic +import org.junit.Test -class Groovy9261 extends GroovyTestCase { +import static groovy.test.GroovyAssert.shouldFail + +@CompileStatic +final class Groovy9261 { + + @Test void testInvalidResourceInARM() { - String errMsg = shouldFail '''\ + def err = shouldFail '''\ @groovy.transform.CompileStatic void test() { try (String str = '123') { @@ -31,12 +37,13 @@ class Groovy9261 extends GroovyTestCase { test() ''' - assert errMsg.contains('Resource[java.lang.String] in ARM should be of type AutoCloseable') - assert errMsg.contains('@ line 3, column 22.') + assert err.message.contains('Resource[java.lang.String] in ARM should be of type AutoCloseable') + assert err.message.contains('@ line 3, column 22.') } + @Test void testInvalidResourceInARM2() { - String errMsg = shouldFail '''\ + def err = shouldFail '''\ @groovy.transform.CompileStatic void test() { try (str = '123') { @@ -45,12 +52,13 @@ class Groovy9261 extends GroovyTestCase { test() ''' - assert errMsg.contains('Resource[java.lang.String] in ARM should be of type AutoCloseable') - assert errMsg.contains('@ line 3, column 22.') + assert err.message.contains('Resource[java.lang.String] in ARM should be of type AutoCloseable') + assert err.message.contains('@ line 3, column 22.') } + @Test void testInvalidResourceInARM3() { - String errMsg = shouldFail '''\ + def err = shouldFail '''\ @groovy.transform.CompileStatic void test() { try (def sr = new StringReader(''); str = '123') { @@ -59,12 +67,13 @@ class Groovy9261 extends GroovyTestCase { test() ''' - assert errMsg.contains('Resource[java.lang.String] in ARM should be of type AutoCloseable') - assert errMsg.contains('@ line 3, column 53.') + assert err.message.contains('Resource[java.lang.String] in ARM should be of type AutoCloseable') + assert err.message.contains('@ line 3, column 53.') } + @Test void testInvalidResourceInEnhancedARM() { - String errMsg = shouldFail '''\ + def err = shouldFail '''\ @groovy.transform.CompileStatic void test() { String str = '123' @@ -74,7 +83,7 @@ class Groovy9261 extends GroovyTestCase { test() ''' - assert errMsg.contains('Resource[java.lang.String] in ARM should be of type AutoCloseable') - assert errMsg.contains('@ line 4, column 22.') + assert err.message.contains('Resource[java.lang.String] in ARM should be of type AutoCloseable') + assert err.message.contains('@ line 4, column 22.') } } diff --git a/subprojects/groovy-test/src/test/groovy/groovy/test/suite/ATestScriptThatsNoTestCase.groovy b/subprojects/groovy-test/src/test/groovy/groovy/test/suite/ATestScriptThatsNoTestCase.groovy index 733a0d6..bc73469 100644 --- a/subprojects/groovy-test/src/test/groovy/groovy/test/suite/ATestScriptThatsNoTestCase.groovy +++ b/subprojects/groovy-test/src/test/groovy/groovy/test/suite/ATestScriptThatsNoTestCase.groovy @@ -16,5 +16,7 @@ * specific language governing permissions and limitations * under the License. */ +package groovy.test.suite + // used for testing ScriptTestCaseAdapter usage with AllTestSuite -assert true \ No newline at end of file +assert true