You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by go...@apache.org on 2012/11/03 00:57:54 UTC
svn commit: r1405224 - in
/incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml:
MXMLIntNodeTests.java MXMLUintNodeTests.java
Author: gordonsmith
Date: Fri Nov 2 23:57:54 2012
New Revision: 1405224
URL: http://svn.apache.org/viewvc?rev=1405224&view=rev
Log:
Falcon: Added parsing tests for <int> and <uint> tags with 0x and # literals inside.
Modified:
incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLIntNodeTests.java
incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLUintNodeTests.java
Modified: incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLIntNodeTests.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLIntNodeTests.java?rev=1405224&r1=1405223&r2=1405224&view=diff
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLIntNodeTests.java (original)
+++ incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLIntNodeTests.java Fri Nov 2 23:57:54 2012
@@ -127,6 +127,60 @@ public class MXMLIntNodeTests extends MX
}
@Test
+ public void MXMLIntNode_hex_short_zero()
+ {
+ String code = "<fx:int>0x0</fx:int>";
+ IMXMLIntNode node = getMXMLIntNode(code);
+ assertThat("getValue", node.getValue(), is(0));
+ testExpressionLocation(node, 8, 11);
+ }
+
+ @Test
+ public void MXMLIntNode_hex_max()
+ {
+ String code = "<fx:int>0x7FFFffff</fx:int>";
+ IMXMLIntNode node = getMXMLIntNode(code);
+ assertThat("getValue", node.getValue(), is(2147483647));
+ testExpressionLocation(node, 8, 18);
+ }
+
+ @Test
+ public void MXMLIntNode_hex_min()
+ {
+ String code = "<fx:int>-0X80000000</fx:int>";
+ IMXMLIntNode node = getMXMLIntNode(code);
+ assertThat("getValue", node.getValue(), is(-2147483648));
+ testExpressionLocation(node, 8, 19);
+ }
+
+ @Test
+ public void MXMLIntNode_hash_short_zero()
+ {
+ String code = "<fx:int>#0</fx:int>";
+ IMXMLIntNode node = getMXMLIntNode(code);
+ assertThat("getValue", node.getValue(), is(0));
+ testExpressionLocation(node, 8, 10);
+ }
+
+ @Test
+ public void MXMLIntNode_hash_max()
+ {
+ String code = "<fx:int>#7FFFFFFF</fx:int>";
+ IMXMLIntNode node = getMXMLIntNode(code);
+ assertThat("getValue", node.getValue(), is(2147483647));
+ testExpressionLocation(node, 8, 17);
+ }
+
+ @Test
+ public void MXMLIntNode_hash_min()
+ {
+ String code = "<fx:int>-#80000000</fx:int>";
+ IMXMLIntNode node = getMXMLIntNode(code);
+ assertThat("getValue", node.getValue(), is(-2147483648));
+ testExpressionLocation(node, 8, 18);
+ }
+
+ @Test
public void MXMLIntNode_withWhitespace()
{
String code = "<fx:int> -123 </fx:int>";
Modified: incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLUintNodeTests.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLUintNodeTests.java?rev=1405224&r1=1405223&r2=1405224&view=diff
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLUintNodeTests.java (original)
+++ incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLUintNodeTests.java Fri Nov 2 23:57:54 2012
@@ -23,8 +23,10 @@ import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
import org.apache.flex.compiler.tree.ASTNodeID;
+import org.apache.flex.compiler.tree.as.IASNode;
import org.apache.flex.compiler.tree.mxml.IMXMLFileNode;
import org.apache.flex.compiler.tree.mxml.IMXMLUintNode;
+import org.junit.Ignore;
import org.junit.Test;
/**
@@ -71,6 +73,88 @@ public class MXMLUintNodeTests extends M
}
@Test
+ public void MXMLUintNode_zero()
+ {
+ String code = "<fx:uint>0</fx:uint>";
+ IMXMLUintNode node = getMXMLUintNode(code);
+ assertThat("getValue", node.getValue(), is(0L));
+ testExpressionLocation(node, 9, 10);
+ }
+
+ @Test
+ public void MXMLUintNode_one()
+ {
+ String code = "<fx:uint>1</fx:uint>";
+ IMXMLUintNode node = getMXMLUintNode(code);
+ assertThat("getValue", node.getValue(), is(1L));
+ testExpressionLocation(node, 9, 10);
+ }
+
+ @Test
+ public void MXMLUintNode_maxUint()
+ {
+ String code = "<fx:uint>4294967295</fx:uint>";
+ IMXMLUintNode node = getMXMLUintNode(code);
+ assertThat("getValue", node.getValue(), is(4294967295L));
+ testExpressionLocation(node, 9, 19);
+ }
+
+ @Test
+ public void MXMLUintNode_hex_short_zero()
+ {
+ String code = "<fx:uint>0x0</fx:uint>";
+ IMXMLUintNode node = getMXMLUintNode(code);
+ assertThat("getValue", node.getValue(), is(0L));
+ testExpressionLocation(node, 9, 12);
+ }
+
+ @Test
+ public void MXMLUintNode_hex_max()
+ {
+ String code = "<fx:uint>0x7FFFffff</fx:uint>";
+ IMXMLUintNode node = getMXMLUintNode(code);
+ assertThat("getValue", node.getValue(), is(2147483647L));
+ testExpressionLocation(node, 9, 19);
+ }
+
+ @Test
+ public void MXMLUintNode_hash_short_zero()
+ {
+ String code = "<fx:uint>#0</fx:uint>";
+ IMXMLUintNode node = getMXMLUintNode(code);
+ assertThat("getValue", node.getValue(), is(0L));
+ testExpressionLocation(node, 9, 11);
+ }
+
+ @Test
+ public void MXMLUintNode_hash_max()
+ {
+ String code = "<fx:uint>#7FFFFFFF</fx:uint>";
+ IMXMLUintNode node = getMXMLUintNode(code);
+ assertThat("getValue", node.getValue(), is(2147483647L));
+ testExpressionLocation(node, 9, 18);
+ }
+
+ @Test
+ public void MXMLUintNode_withWhitespace()
+ {
+ String code = "<fx:uint> 123 </fx:uint>";
+ IMXMLUintNode node = getMXMLUintNode(code);
+ assertThat("getValue", node.getValue(), is(123L));
+ //testExpressionLocation(node, 9, 13); // location of the MXMLLiteralNode should not include the whitespace
+ }
+
+ @Ignore
+ @Test
+ public void MXMLUintNode_nonnumeric()
+ {
+ String code = "<fx:uint> abc </fx:uint>";
+ IMXMLUintNode node = getMXMLUintNode(code);
+ assertThat("getValue", node.getValue(), is(0L));
+ assertThat("getExpressionNode", node.getExpressionNode(), is((IASNode)null));
+ }
+
+ @Test
public void MXMLUintNode_with_databinding()
{
String code = "<fx:uint>{a.b}</fx:uint>";