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:42 UTC

[royale-compiler] branch develop updated (ac1383ca9 -> 4a6536f57)

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

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


    from ac1383ca9 missing swfdumps to fix tests
     new c8f3050df Tests: better error messaging when Flash Player or playerglobal is defined in environment, but not both
     new 4a6536f57 Tests: more nullish coalescing operator tests

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 compiler/src/test/java/as/ASFeatureTestsBase.java  | 15 ++++++
 .../java/as/ASNullishCoalescingOperatorTests.java  | 56 ++++++++++++++++++++++
 .../test/java/mxml/tags/MXMLFeatureTestsBase.java  | 14 ++++++
 3 files changed, 85 insertions(+)


[royale-compiler] 02/02: Tests: more nullish coalescing operator tests

Posted by jo...@apache.org.
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 4a6536f57057d59b625c349057a9cc64ef7bf2fa
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Tue Nov 29 12:43:21 2022 -0800

    Tests: more nullish coalescing operator tests
---
 .../java/as/ASNullishCoalescingOperatorTests.java  | 56 ++++++++++++++++++++++
 1 file changed, 56 insertions(+)

diff --git a/compiler/src/test/java/as/ASNullishCoalescingOperatorTests.java b/compiler/src/test/java/as/ASNullishCoalescingOperatorTests.java
index a58d777b1..5e593120d 100644
--- a/compiler/src/test/java/as/ASNullishCoalescingOperatorTests.java
+++ b/compiler/src/test/java/as/ASNullishCoalescingOperatorTests.java
@@ -81,4 +81,60 @@ public class ASNullishCoalescingOperatorTests extends ASFeatureTestsBase
 
         compileAndRun(source);
     }
+
+    @Test
+    public void testUnparenthesizedLogicalAndBefore()
+    {
+        String[] testCode = new String[]
+        {
+            "var bool:Boolean = true",
+            "var s:String = 'foo';",
+			"var result:Object = bool && s ?? 'bar';",
+        };
+        String source = getAS(new String[0], new String[0], testCode, new String[0]);
+
+        compileAndExpectErrors(source, false, false, false, new String[0], "Cannot use '??' unparenthesized within '||' and '&&' expressions.\n");
+    }
+
+    @Test
+    public void testUnparenthesizedLogicalAndAfter()
+    {
+        String[] testCode = new String[]
+        {
+            "var bool:Boolean = true",
+            "var s:String = 'foo';",
+			"var result:Object = s ?? 'bar' && bool;",
+        };
+        String source = getAS(new String[0], new String[0], testCode, new String[0]);
+
+        compileAndExpectErrors(source, false, false, false, new String[0], "Cannot use '??' unparenthesized within '||' and '&&' expressions.\n");
+    }
+
+    @Test
+    public void testUnparenthesizedLogicalOrBefore()
+    {
+        String[] testCode = new String[]
+        {
+            "var bool:Boolean = false",
+            "var s:String = 'foo';",
+			"var result:Object = bool || s ?? 'bar';",
+        };
+        String source = getAS(new String[0], new String[0], testCode, new String[0]);
+
+        compileAndExpectErrors(source, false, false, false, new String[0], "Cannot use '??' unparenthesized within '||' and '&&' expressions.\n");
+    }
+
+    @Test
+    public void testUnparenthesizedLogicalOrAfter()
+    {
+        String[] testCode = new String[]
+        {
+            "var bool:Boolean = false",
+            "var s:String = 'foo';",
+			"var result:Object = s ?? 'bar' || bool;",
+        };
+        String source = getAS(new String[0], new String[0], testCode, new String[0]);
+
+        compileAndExpectErrors(source, false, false, false, new String[0], "Cannot use '??' unparenthesized within '||' and '&&' expressions.\n");
+    }
 }


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

Posted by jo...@apache.org.
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;