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/12/12 22:41:12 UTC

[royale-compiler] branch develop updated: compiler-jx: a couple of missing tests for date properties

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


The following commit(s) were added to refs/heads/develop by this push:
     new 4198ddd0b compiler-jx: a couple of missing tests for date properties
4198ddd0b is described below

commit 4198ddd0b02028837b0ce98258b082b73c341386
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Mon Dec 12 14:41:02 2022 -0800

    compiler-jx: a couple of missing tests for date properties
---
 .../codegen/js/royale/TestRoyaleGlobalClasses.java | 36 ++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/compiler-jx/src/test/java/org/apache/royale/compiler/internal/codegen/js/royale/TestRoyaleGlobalClasses.java b/compiler-jx/src/test/java/org/apache/royale/compiler/internal/codegen/js/royale/TestRoyaleGlobalClasses.java
index 403ab413e..8c7c15f78 100644
--- a/compiler-jx/src/test/java/org/apache/royale/compiler/internal/codegen/js/royale/TestRoyaleGlobalClasses.java
+++ b/compiler-jx/src/test/java/org/apache/royale/compiler/internal/codegen/js/royale/TestRoyaleGlobalClasses.java
@@ -716,6 +716,42 @@ public class TestRoyaleGlobalClasses extends TestGoogGlobalClasses
         assertOut("a.setFullYear(10, 0, 0)");
     }
 
+    @Test
+    public void testDateGetDay()
+    {
+        IVariableNode node = getVariable("var a:Date = new Date(); var b:Number = a.day");
+        node = (IVariableNode)(node.getParent().getChild(1));
+        asBlockWalker.visitVariable(node);
+        assertOut("var /** @type {number} */ b = a.getDay()");
+    }
+
+    @Test
+    public void testDateGetDayMethod()
+    {
+        IVariableNode node = getVariable("var a:Date = new Date(); var b:Number = a.getDay()");
+        node = (IVariableNode)(node.getParent().getChild(1));
+        asBlockWalker.visitVariable(node);
+        assertOut("var /** @type {number} */ b = a.getDay()");
+    }
+
+    @Test
+    public void testDateGetTimezoneOffset()
+    {
+        IVariableNode node = getVariable("var a:Date = new Date(); var b:Number = a.timezoneOffset");
+        node = (IVariableNode)(node.getParent().getChild(1));
+        asBlockWalker.visitVariable(node);
+        assertOut("var /** @type {number} */ b = a.getTimezoneOffset()");
+    }
+
+    @Test
+    public void testDateGetTimezoneOffsetMethod()
+    {
+        IVariableNode node = getVariable("var a:Date = new Date(); var b:Number = a.getTimezoneOffset()");
+        node = (IVariableNode)(node.getParent().getChild(1));
+        asBlockWalker.visitVariable(node);
+        assertOut("var /** @type {number} */ b = a.getTimezoneOffset()");
+    }
+
     @Override
     @Test
     public void testVector()