You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by jo...@apache.org on 2022/11/29 20:46:43 UTC

[royale-compiler] 01/02: Tests: better error messaging when Flash Player or playerglobal is defined in environment, but not both

This is an automated email from the ASF dual-hosted git repository.

joshtynjala pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git

commit c8f3050df7a81d4aa82dd74634850869b8e60bca
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Tue Nov 29 12:33:00 2022 -0800

    Tests: better error messaging when Flash Player or playerglobal is defined in environment, but not both
---
 compiler/src/test/java/as/ASFeatureTestsBase.java         | 15 +++++++++++++++
 .../src/test/java/mxml/tags/MXMLFeatureTestsBase.java     | 14 ++++++++++++++
 2 files changed, 29 insertions(+)

diff --git a/compiler/src/test/java/as/ASFeatureTestsBase.java b/compiler/src/test/java/as/ASFeatureTestsBase.java
index 0b2c5973c..3e6ff8ab1 100644
--- a/compiler/src/test/java/as/ASFeatureTestsBase.java
+++ b/compiler/src/test/java/as/ASFeatureTestsBase.java
@@ -64,6 +64,20 @@ public class ASFeatureTestsBase
 		if(playerGlobal == null || !playerGlobal.isFile() || !playerGlobal.exists()) {
 			hasFlashPlayerGlobal = false;
 		}
+
+		if (hasFlashPlayerExecutable && !hasFlashPlayerGlobal)
+		{
+			String message = "Fatal Error: If FLASHPLAYER_DEBUGGER is defined, playerglobal must be available";
+			System.err.println(message);
+			fail(message);
+		}
+
+		if (!hasFlashPlayerExecutable && hasFlashPlayerGlobal)
+		{
+			String message = "Fatal Error: If playerglobal is available, FLASHPLAYER_DEBUGGER is required";
+			System.err.println(message);
+			fail(message);
+		}
 	}
 
 	protected boolean hasFlashPlayerExecutable = true;
@@ -174,6 +188,7 @@ public class ASFeatureTestsBase
         String results = compile(tempASFile, source, withFramework, withRPC, withSpark, otherOptions, false);
         assertThat(results, is(errors));
     }
+
 	protected void compileAndRun(String source, boolean withFramework, boolean withRPC, boolean withSpark, String[] otherOptions)
 	{
 	    int exitCode = 0;
diff --git a/compiler/src/test/java/mxml/tags/MXMLFeatureTestsBase.java b/compiler/src/test/java/mxml/tags/MXMLFeatureTestsBase.java
index c46ba75f1..8d4209946 100644
--- a/compiler/src/test/java/mxml/tags/MXMLFeatureTestsBase.java
+++ b/compiler/src/test/java/mxml/tags/MXMLFeatureTestsBase.java
@@ -71,6 +71,20 @@ public class MXMLFeatureTestsBase
 		if(playerGlobal == null || !playerGlobal.isFile() || !playerGlobal.exists()) {
 			hasFlashPlayerGlobal = false;
 		}
+
+		if (hasFlashPlayerExecutable && !hasFlashPlayerGlobal)
+		{
+			String message = "Fatal Error: If FLASHPLAYER_DEBUGGER is defined, playerglobal must be available";
+			System.err.println(message);
+			fail(message);
+		}
+
+		if (!hasFlashPlayerExecutable && hasFlashPlayerGlobal)
+		{
+			String message = "Fatal Error: If playerglobal is available, FLASHPLAYER_DEBUGGER is required";
+			System.err.println(message);
+			fail(message);
+		}
 	}
 
 	protected boolean hasFlashPlayerExecutable = true;