You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2021/07/26 03:47:04 UTC

[groovy] branch GROOVY_3_0_X updated: Tweak test utils to get correct paths

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


The following commit(s) were added to refs/heads/GROOVY_3_0_X by this push:
     new 0973178  Tweak test utils to get correct paths
0973178 is described below

commit 0973178dabc1576d762f962b0e252905ba9a2c7c
Author: Daniel Sun <su...@apache.org>
AuthorDate: Mon Jul 26 11:46:22 2021 +0800

    Tweak test utils to get correct paths
---
 .../src/test/groovy/org/apache/groovy/parser/antlr4/TestUtils.groovy | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/TestUtils.groovy b/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/TestUtils.groovy
index 5740c34..0322c3e 100644
--- a/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/TestUtils.groovy
+++ b/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/TestUtils.groovy
@@ -189,7 +189,7 @@ final class TestUtils {
     }
 
     static void doRunAndShouldFail(String path) {
-        assert !executeScript(createAntlr4Shell(), path)
+        assert !executeScript(createAntlr4Shell(), "$RESOURCES_PATH/$path")
     }
 
     static void doRunAndTest(String path) {
@@ -262,6 +262,7 @@ final class TestUtils {
 
     private static boolean executeScript(GroovyShell shell, String path) {
         def file = new File(path)
+        assert file.exists() : "Test resource not found: $file.absolutePath"
         try {
             shell.evaluate(file.text)
             return true
@@ -274,7 +275,7 @@ final class TestUtils {
     private static String readZipEntry(String path, String entryName) {
         String result = ''
 
-        try (zf = new ZipFile(new File(path))) {
+        try (def zf = new ZipFile(new File(path))) {
             def is = new BufferedInputStream(zf.getInputStream(new ZipEntry(entryName)))
             result = is.getText('UTF-8')
         } catch (e) {