incubator-flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gordonsm...@apache.org
Subject svn commit: r1400567 - /incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/
Date Sun, 21 Oct 2012 03:46:26 GMT
Author: gordonsmith
Date: Sun Oct 21 03:46:25 2012
New Revision: 1400567

URL: http://svn.apache.org/viewvc?rev=1400567&view=rev
Log:
Falcon: Added some trivial unit tests for the other expression nodes: <uint>, <Number>,
<String>, <Class>, <Function>, and <RegExp>. These need to be filled
out with more cases in the same fashion as <Boolean>.

Added:
    incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLClassNodeTests.java
  (with props)
    incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLFunctionNodeTests.java
  (with props)
    incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLNumberNodeTests.java
  (with props)
    incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLRegExpNodeTests.java
  (with props)
    incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLStringNodeTests.java
  (with props)
    incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLUintNodeTests.java
  (with props)
Modified:
    incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLBooleanNodeTests.java
    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/MXMLNodeBaseTests.java

Modified: incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLBooleanNodeTests.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLBooleanNodeTests.java?rev=1400567&r1=1400566&r2=1400567&view=diff
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLBooleanNodeTests.java
(original)
+++ incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLBooleanNodeTests.java
Sun Oct 21 03:46:25 2012
@@ -21,8 +21,8 @@ public class MXMLBooleanNodeTests extend
 	{
 		IMXMLFileNode fileNode = getMXMLFileNode(code);
 		IMXMLBooleanNode node = (IMXMLBooleanNode)findFirstDescendantOfType(fileNode, IMXMLBooleanNode.class);
-		assertThat(node.getNodeID(), is(ASTNodeID.MXMLBooleanID));
-		assertThat(node.getName(), is("Boolean"));
+		assertThat("getNodeID", node.getNodeID(), is(ASTNodeID.MXMLBooleanID));
+		assertThat("getName", node.getName(), is("Boolean"));
 		return node;
 	}
 	
@@ -31,8 +31,8 @@ public class MXMLBooleanNodeTests extend
 	{
 		String code = "<fx:Boolean/>";
 		IMXMLBooleanNode node = getMXMLBooleanNode(code);
-		assertThat(node.getValue(), is(false));
-		//assertThat(node.getExpressionNode(), is((IASNode)null));
+		assertThat("getValue", node.getValue(), is(false));
+		//assertThat("getExpressionNode", node.getExpressionNode(), is((IASNode)null));
 	}
 	
 	@Test
@@ -40,8 +40,8 @@ public class MXMLBooleanNodeTests extend
 	{
 		String code = "<fx:Boolean></fx:Boolean>";
 		IMXMLBooleanNode node = getMXMLBooleanNode(code);
-		assertThat(node.getValue(), is(false));
-		//assertThat(node.getExpressionNode(), is((IASNode)null));
+		assertThat("getValue", node.getValue(), is(false));
+		//assertThat("getExpressionNode", node.getExpressionNode(), is((IASNode)null));
 	}
 
 	@Test
@@ -49,8 +49,8 @@ public class MXMLBooleanNodeTests extend
 	{
 		String code = "<fx:Boolean> \t\r\n</fx:Boolean>";
 		IMXMLBooleanNode node = getMXMLBooleanNode(code);
-		assertThat(node.getValue(), is(false));
-		//assertThat(node.getExpressionNode(), is((IASNode)null));
+		assertThat("getValue", node.getValue(), is(false));
+		//assertThat("getExpressionNode", node.getExpressionNode(), is((IASNode)null));
 	}
 
 	@Test
@@ -58,7 +58,7 @@ public class MXMLBooleanNodeTests extend
 	{
 		String code = "<fx:Boolean>false</fx:Boolean>";
 		IMXMLBooleanNode node = getMXMLBooleanNode(code);
-		assertThat(node.getValue(), is(false));
+		assertThat("getValue", node.getValue(), is(false));
 		testExpressionLocation(node, 12, 17);
 	}
 
@@ -67,7 +67,7 @@ public class MXMLBooleanNodeTests extend
 	{
 		String code = "<fx:Boolean>true</fx:Boolean>";
 		IMXMLBooleanNode node = getMXMLBooleanNode(code);
-		assertThat(node.getValue(), is(true));
+		assertThat("getValue", node.getValue(), is(true));
 		testExpressionLocation(node, 12, 16);
 	}
 
@@ -76,7 +76,7 @@ public class MXMLBooleanNodeTests extend
 	{
 		String code = "<fx:Boolean>FaLsE</fx:Boolean>";
 		IMXMLBooleanNode node = getMXMLBooleanNode(code);
-		assertThat(node.getValue(), is(false));
+		assertThat("getValue", node.getValue(), is(false));
 		testExpressionLocation(node, 12, 17);
 	}
 
@@ -85,7 +85,7 @@ public class MXMLBooleanNodeTests extend
 	{
 		String code = "<fx:Boolean>TruE</fx:Boolean>";
 		IMXMLBooleanNode node = getMXMLBooleanNode(code);
-		assertThat(node.getValue(), is(true));
+		assertThat("getValue", node.getValue(), is(true));
 		testExpressionLocation(node, 12, 16);
 	}
 	
@@ -94,7 +94,7 @@ public class MXMLBooleanNodeTests extend
 	{
 		String code = "<fx:Boolean> false </fx:Boolean>";
 		IMXMLBooleanNode node = getMXMLBooleanNode(code);
-		assertThat(node.getValue(), is(false));
+		assertThat("getValue", node.getValue(), is(false));
 		//testExpressionLocation(node, 13, 18);  // location of the MXMLLiteralNode should not
include the whitespace 
 	}
 
@@ -103,18 +103,46 @@ public class MXMLBooleanNodeTests extend
 	{
 		String code = "<fx:Boolean> true </fx:Boolean>";
 		IMXMLBooleanNode node = getMXMLBooleanNode(code);
-		assertThat(node.getValue(), is(true));
+		assertThat("getValue", node.getValue(), is(true));
 		//testExpressionLocation(node, 13, 17); // location of the MXMLLiteralNode should not include
the whitespace
 	}
-
+	
+	@Test
+	public void MXMLBooleanNode_with_comments()
+	{
+		String code = "<fx:Boolean>t<!-- comment -->ru<!--- comment -->e</fx:Boolean>";
+		IMXMLBooleanNode node = getMXMLBooleanNode(code);
+		assertThat("getValue", node.getValue(), is(true));
+		testExpressionLocation(node, 12, 49);
+	}
+	
+	@Test
+	public void MXMLBooleanNode_with_entities()
+	{
+		String code = "<fx:Boolean>t&#114;u&#x65;</fx:Boolean>";
+		IMXMLBooleanNode node = getMXMLBooleanNode(code);
+		assertThat("getValue", node.getValue(), is(true));
+		testExpressionLocation(node, 12, 26);
+	}
+	
+	@Ignore
+	@Test
+	public void MXMLBooleanNode_with_cdata()
+	{
+		String code = "<fx:Boolean>t<![CDATA[r]]>u<![CDATA[e]]></fx:Boolean>";
+		IMXMLBooleanNode node = getMXMLBooleanNode(code);
+		assertThat("getValue", node.getValue(), is(true));
+		testExpressionLocation(node, 12, 40);
+	}
+	
 	@Ignore
 	@Test
 	public void MXMLBooleanNode_abc()
 	{
 		String code = "<fx:Boolean>abc</fx:Boolean>";
 		IMXMLBooleanNode node = getMXMLBooleanNode(code);
-		assertThat(node.getValue(), is(false));
-		assertThat(node.getExpressionNode(), is((IASNode)null));
+		assertThat("getValue", node.getValue(), is(false));
+		assertThat("getExpressionNode", node.getExpressionNode(), is((IASNode)null));
 	}
 	
 	@Test
@@ -122,7 +150,7 @@ public class MXMLBooleanNodeTests extend
 	{
 		String code = "<fx:Boolean xmlns:foo='bar'>true</fx:Boolean>";
 		IMXMLBooleanNode node = getMXMLBooleanNode(code);
-		assertThat(node.getValue(), is(true));
+		assertThat("getValue", node.getValue(), is(true));
 		testExpressionLocation(node, 28, 32);
 	}
 	
@@ -131,7 +159,7 @@ public class MXMLBooleanNodeTests extend
 	{
 		String code = "<fx:Boolean id='b1'>true</fx:Boolean>";
 		IMXMLBooleanNode node = getMXMLBooleanNode(code);
-		assertThat(node.getValue(), is(true));
+		assertThat("getValue", node.getValue(), is(true));
 		testExpressionLocation(node, 20, 24);
 	}
 	
@@ -140,7 +168,7 @@ public class MXMLBooleanNodeTests extend
 	{
 		String code = "<fx:Boolean foo='bar'>true</fx:Boolean>";
 		IMXMLBooleanNode node = getMXMLBooleanNode(code);
-		assertThat(node.getValue(), is(true));
+		assertThat("getValue", node.getValue(), is(true));
 		testExpressionLocation(node, 22, 26);
 		// check problem
 	}
@@ -151,6 +179,6 @@ public class MXMLBooleanNodeTests extend
 	{
 		String code = "<fx:Boolean>true<foo/></fx:Boolean>";
 		IMXMLBooleanNode node = getMXMLBooleanNode(code);
-		assertThat(node.getValue(), is(true));
+		assertThat("getValue", node.getValue(), is(true));
 	}
 }

Added: incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLClassNodeTests.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLClassNodeTests.java?rev=1400567&view=auto
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLClassNodeTests.java
(added)
+++ incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLClassNodeTests.java
Sun Oct 21 03:46:25 2012
@@ -0,0 +1,63 @@
+package org.apache.flex.compiler.internal.tree.mxml;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+import org.apache.flex.compiler.definitions.ITypeDefinition;
+import org.apache.flex.compiler.tree.ASTNodeID;
+import org.apache.flex.compiler.tree.mxml.IMXMLFileNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLClassNode;
+import org.junit.Test;
+
+/**
+ * JUnit tests for {@link MXMLClassNode}.
+ * 
+ * @author Gordon Smith
+ */
+public class MXMLClassNodeTests extends MXMLExpressionNodeBaseTests
+{
+	private IMXMLClassNode getMXMLClassNode(String code)
+	{
+		IMXMLFileNode fileNode = getMXMLFileNode(code);
+		IMXMLClassNode node = (IMXMLClassNode)findFirstDescendantOfType(fileNode, IMXMLClassNode.class);
+		assertThat("getNodeID", node.getNodeID(), is(ASTNodeID.MXMLClassID));
+		assertThat("getName", node.getName(), is("Class"));
+		return node;
+	}
+	
+	@Test
+	public void MXMLClassNode_empty1()
+	{
+		String code = "<fx:Class/>";
+		IMXMLClassNode node = getMXMLClassNode(code);
+		assertThat("getValue", node.getValue(project), is((ITypeDefinition)null));
+		//assertThat("getExpressionNode", node.getExpressionNode(), is((IASNode)null));
+	}
+	
+	@Test
+	public void MXMLClassNode_empty2()
+	{
+		String code = "<fx:Class></fx:Class>";
+		IMXMLClassNode node = getMXMLClassNode(code);
+		assertThat("getValue", node.getValue(project), is((ITypeDefinition)null));
+		//assertThat("getExpressionNode", node.getExpressionNode(), is((IASNode)null));
+	}
+
+	@Test
+	public void MXMLClassNode_empty3()
+	{
+		String code = "<fx:Class> \t\r\n</fx:Class>";
+		IMXMLClassNode node = getMXMLClassNode(code);
+		assertThat("getValue", node.getValue(project), is((ITypeDefinition)null));
+		//assertThat("getExpressionNode", node.getExpressionNode(), is((IASNode)null));
+	}
+
+	@Test
+	public void MXMLClassNode_flashDisplaySprite()
+	{
+		String code = "<fx:Class>flash.display.Sprite</fx:Class>";
+		IMXMLClassNode node = getMXMLClassNode(code);
+		assertThat("getValue", node.getValue(project).getQualifiedName(), is("flash.display.Sprite"));
+		//assertThat("getExpressionNode", node.getExpressionNode(), is((IASNode)null));
+	}
+}

Propchange: incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLClassNodeTests.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLFunctionNodeTests.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLFunctionNodeTests.java?rev=1400567&view=auto
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLFunctionNodeTests.java
(added)
+++ incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLFunctionNodeTests.java
Sun Oct 21 03:46:25 2012
@@ -0,0 +1,75 @@
+package org.apache.flex.compiler.internal.tree.mxml;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+import org.apache.flex.compiler.definitions.IFunctionDefinition;
+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.IMXMLFunctionNode;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * JUnit tests for {@link MXMLFunctionNode}.
+ * 
+ * @author Gordon Smith
+ */
+public class MXMLFunctionNodeTests extends MXMLExpressionNodeBaseTests
+{
+	private IMXMLFunctionNode getMXMLFunctionNode(String code)
+	{
+		IMXMLFileNode fileNode = getMXMLFileNode(code);
+		IMXMLFunctionNode node = (IMXMLFunctionNode)findFirstDescendantOfType(fileNode, IMXMLFunctionNode.class);
+		assertThat("getNodeID", node.getNodeID(), is(ASTNodeID.MXMLFunctionID));
+		assertThat("getName", node.getName(), is("Function"));
+		return node;
+	}
+	
+	@Test
+	public void MXMLFunctionNode_empty1()
+	{
+		String code = "<fx:Function/>";
+		IMXMLFunctionNode node = getMXMLFunctionNode(code);
+		assertThat("getValue", node.getValue(project), is((IFunctionDefinition)null));
+		assertThat("getExpressionNode", node.getExpressionNode(), is((IASNode)null));
+	}
+	
+	@Test
+	public void MXMLFunctionNode_empty2()
+	{
+		String code = "<fx:Function></fx:Function>";
+		IMXMLFunctionNode node = getMXMLFunctionNode(code);
+		assertThat("getValue", node.getValue(project), is((IFunctionDefinition)null));
+		assertThat("getExpressionNode", node.getExpressionNode(), is((IASNode)null));
+	}
+
+	@Test
+	public void MXMLFunctionNode_empty3()
+	{
+		String code = "<fx:Function> \t\r\n</fx:Function>";
+		IMXMLFunctionNode node = getMXMLFunctionNode(code);
+		assertThat("getValue", node.getValue(project), is((IFunctionDefinition)null));
+		assertThat("getExpressionNode", node.getExpressionNode(), is((IASNode)null));
+	}
+
+	@Test
+	public void MXMLFunctionNode_trace()
+	{
+		String code = "<fx:Function>trace</fx:Function>";
+		IMXMLFunctionNode node = getMXMLFunctionNode(code);
+		assertThat("getValue", node.getValue(project).getQualifiedName(), is("trace"));
+		testExpressionLocation(node, 13, 18);
+	}
+
+	@Ignore
+	@Test
+	public void MXMLFunctionNode_flash_utils_getQualifiedClassName()
+	{
+		String code = "<fx:Function>flash.utils.getQualifiedClassName</fx:Function>";
+		IMXMLFunctionNode node = getMXMLFunctionNode(code);
+		assertThat("getValue", node.getValue(project).getQualifiedName(), is("flash.utils.getQualifiedClassName"));
+		testExpressionLocation(node, 13, 41);
+	}
+}

Propchange: incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLFunctionNodeTests.java
------------------------------------------------------------------------------
    svn:eol-style = native

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=1400567&r1=1400566&r2=1400567&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
Sun Oct 21 03:46:25 2012
@@ -21,8 +21,8 @@ public class MXMLIntNodeTests extends MX
 	{
 		IMXMLFileNode fileNode = getMXMLFileNode(code);
 		IMXMLIntNode node = (IMXMLIntNode)findFirstDescendantOfType(fileNode, IMXMLIntNode.class);
-		assertThat(node.getNodeID(), is(ASTNodeID.MXMLIntID));
-		assertThat(node.getName(), is("int"));
+		assertThat("getNodeID", node.getNodeID(), is(ASTNodeID.MXMLIntID));
+		assertThat("getName", node.getName(), is("int"));
 		return node;
 	}
 	
@@ -31,8 +31,8 @@ public class MXMLIntNodeTests extends MX
 	{
 		String code = "<fx:int/>";
 		IMXMLIntNode node = getMXMLIntNode(code);
-		assertThat(node.getValue(), is(0));
-		//assertThat(node.getExpressionNode(), is((IASNode)null));
+		assertThat("getValue", node.getValue(), is(0));
+		//assertThat("getExpressionNode", node.getExpressionNode(), is((IASNode)null));
 	}
 	
 	@Test
@@ -40,8 +40,8 @@ public class MXMLIntNodeTests extends MX
 	{
 		String code = "<fx:int></fx:int>";
 		IMXMLIntNode node = getMXMLIntNode(code);
-		assertThat(node.getValue(), is(0));
-		//assertThat(node.getExpressionNode(), is((IASNode)null));
+		assertThat("getValue", node.getValue(), is(0));
+		//assertThat("getExpressionNode", node.getExpressionNode(), is((IASNode)null));
 	}
 
 	@Test
@@ -49,8 +49,8 @@ public class MXMLIntNodeTests extends MX
 	{
 		String code = "<fx:int> \t\r\n</fx:int>";
 		IMXMLIntNode node = getMXMLIntNode(code);
-		assertThat(node.getValue(), is(0));
-		//assertThat(node.getExpressionNode(), is((IASNode)null));
+		assertThat("getValue", node.getValue(), is(0));
+		//assertThat("getExpressionNode", node.getExpressionNode(), is((IASNode)null));
 	}
 
 	@Test
@@ -58,7 +58,7 @@ public class MXMLIntNodeTests extends MX
 	{
 		String code = "<fx:int>0</fx:int>";
 		IMXMLIntNode node = getMXMLIntNode(code);
-		assertThat(node.getValue(), is(0));
+		assertThat("getValue", node.getValue(), is(0));
 		testExpressionLocation(node, 8, 9);
 	}
 
@@ -67,7 +67,7 @@ public class MXMLIntNodeTests extends MX
 	{
 		String code = "<fx:int>-0</fx:int>";
 		IMXMLIntNode node = getMXMLIntNode(code);
-		assertThat(node.getValue(), is(0));
+		assertThat("getValue", node.getValue(), is(0));
 		testExpressionLocation(node, 8, 10);
 	}
 
@@ -76,7 +76,7 @@ public class MXMLIntNodeTests extends MX
 	{
 		String code = "<fx:int>1</fx:int>";
 		IMXMLIntNode node = getMXMLIntNode(code);
-		assertThat(node.getValue(), is(1));
+		assertThat("getValue", node.getValue(), is(1));
 		testExpressionLocation(node, 8, 9);
 	}
 
@@ -85,7 +85,7 @@ public class MXMLIntNodeTests extends MX
 	{
 		String code = "<fx:int>-1</fx:int>";
 		IMXMLIntNode node = getMXMLIntNode(code);
-		assertThat(node.getValue(), is(-1));
+		assertThat("getValue", node.getValue(), is(-1));
 		testExpressionLocation(node, 8, 10);
 	}
 
@@ -94,7 +94,7 @@ public class MXMLIntNodeTests extends MX
 	{
 		String code = "<fx:int>2147483647</fx:int>";
 		IMXMLIntNode node = getMXMLIntNode(code);
-		assertThat(node.getValue(), is(2147483647));
+		assertThat("getValue", node.getValue(), is(2147483647));
 		testExpressionLocation(node, 8, 18);
 	}
 
@@ -103,7 +103,7 @@ public class MXMLIntNodeTests extends MX
 	{
 		String code = "<fx:int>-2147483648</fx:int>";
 		IMXMLIntNode node = getMXMLIntNode(code);
-		assertThat(node.getValue(), is(-2147483648));
+		assertThat("getValue", node.getValue(), is(-2147483648));
 		testExpressionLocation(node, 8, 19);
 	}
 	
@@ -112,7 +112,7 @@ public class MXMLIntNodeTests extends MX
 	{
 		String code = "<fx:int> -123 </fx:int>";
 		IMXMLIntNode node = getMXMLIntNode(code);
-		assertThat(node.getValue(), is(-123));
+		assertThat("getValue", node.getValue(), is(-123));
 		//testExpressionLocation(node, 9, 13); // location of the MXMLLiteralNode should not include
the whitespace
 	}
 	
@@ -122,7 +122,7 @@ public class MXMLIntNodeTests extends MX
 	{
 		String code = "<fx:int> abc </fx:int>";
 		IMXMLIntNode node = getMXMLIntNode(code);
-		assertThat(node.getValue(), is(0));
-		assertThat(node.getExpressionNode(), is((IASNode)null));
+		assertThat("getValue", node.getValue(), is(0));
+		assertThat("getExpressionNode", node.getExpressionNode(), is((IASNode)null));
 	}
 }

Modified: incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLNodeBaseTests.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLNodeBaseTests.java?rev=1400567&r1=1400566&r2=1400567&view=diff
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLNodeBaseTests.java
(original)
+++ incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLNodeBaseTests.java
Sun Oct 21 03:46:25 2012
@@ -30,6 +30,8 @@ public class MXMLNodeBaseTests
 
 	protected static Workspace workspace = new Workspace();
 	
+	protected FlexProject project;
+	
 	protected IASNode findFirstDescendantOfType(IASNode node, Class<? extends IASNode>
nodeType)
 	{
 		int n = node.getChildCount();
@@ -49,8 +51,7 @@ public class MXMLNodeBaseTests
 	
 	protected IMXMLFileNode getMXMLFileNode(String code)
 	{
-		//Workspace workspace = new Workspace();
-		FlexProject project = new FlexProject(workspace);
+		project = new FlexProject(workspace);
 		
 		String tempDir = FilenameNormalization.normalize("temp"); // ensure this exists
 				
@@ -110,6 +111,7 @@ public class MXMLNodeBaseTests
 		{
 			e.printStackTrace();
 		}
+		
 		return fileNode;
 	}
 	

Added: incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLNumberNodeTests.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLNumberNodeTests.java?rev=1400567&view=auto
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLNumberNodeTests.java
(added)
+++ incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLNumberNodeTests.java
Sun Oct 21 03:46:25 2012
@@ -0,0 +1,53 @@
+package org.apache.flex.compiler.internal.tree.mxml;
+
+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.mxml.IMXMLFileNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLNumberNode;
+import org.junit.Test;
+
+/**
+ * JUnit tests for {@link MXMLNumberNode}.
+ * 
+ * @author Gordon Smith
+ */
+public class MXMLNumberNodeTests extends MXMLExpressionNodeBaseTests
+{
+	private IMXMLNumberNode getMXMLNumberNode(String code)
+	{
+		IMXMLFileNode fileNode = getMXMLFileNode(code);
+		IMXMLNumberNode node = (IMXMLNumberNode)findFirstDescendantOfType(fileNode, IMXMLNumberNode.class);
+		assertThat("getNodeID", node.getNodeID(), is(ASTNodeID.MXMLNumberID));
+		assertThat("getName", node.getName(), is("Number"));
+		return node;
+	}
+	
+	@Test
+	public void MXMLNumberNode_empty1()
+	{
+		String code = "<fx:Number/>";
+		IMXMLNumberNode node = getMXMLNumberNode(code);
+		assertThat("getValue", node.getValue(), is(Double.NaN));
+		//assertThat("getExpressionNode", node.getExpressionNode(), is((IASNode)null));
+	}
+	
+	@Test
+	public void MXMLNumberNode_empty2()
+	{
+		String code = "<fx:Number></fx:Number>";
+		IMXMLNumberNode node = getMXMLNumberNode(code);
+		assertThat("getValue", node.getValue(), is(Double.NaN));
+		//assertThat("getExpressionNode", node.getExpressionNode(), is((IASNode)null));
+	}
+
+	@Test
+	public void MXMLNumberNode_empty3()
+	{
+		String code = "<fx:Number> \t\r\n</fx:Number>";
+		IMXMLNumberNode node = getMXMLNumberNode(code);
+		assertThat("getValue", node.getValue(), is(Double.NaN));
+		//assertThat("getExpressionNode", node.getExpressionNode(), is((IASNode)null));
+	}
+}

Propchange: incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLNumberNodeTests.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLRegExpNodeTests.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLRegExpNodeTests.java?rev=1400567&view=auto
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLRegExpNodeTests.java
(added)
+++ incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLRegExpNodeTests.java
Sun Oct 21 03:46:25 2012
@@ -0,0 +1,51 @@
+package org.apache.flex.compiler.internal.tree.mxml;
+
+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.IMXMLRegExpNode;
+import org.junit.Test;
+
+/**
+ * JUnit tests for {@link MXMLRegExpNode}.
+ * 
+ * @author Gordon Smith
+ */
+public class MXMLRegExpNodeTests extends MXMLExpressionNodeBaseTests
+{
+	private IMXMLRegExpNode getMXMLRegExpNode(String code)
+	{
+		IMXMLFileNode fileNode = getMXMLFileNode(code);
+		IMXMLRegExpNode node = (IMXMLRegExpNode)findFirstDescendantOfType(fileNode, IMXMLRegExpNode.class);
+		assertThat("getNodeID", node.getNodeID(), is(ASTNodeID.MXMLRegExpID));
+		assertThat("getName", node.getName(), is("RegExp"));
+		return node;
+	}
+	
+	@Test
+	public void MXMLRegExpNode_empty1()
+	{
+		String code = "<fx:RegExp/>";
+		IMXMLRegExpNode node = getMXMLRegExpNode(code);
+		assertThat("getExpressionNode", node.getExpressionNode(), is((IASNode)null));
+	}
+	
+	@Test
+	public void MXMLRegExpNode_empty2()
+	{
+		String code = "<fx:RegExp></fx:RegExp>";
+		IMXMLRegExpNode node = getMXMLRegExpNode(code);
+		assertThat("getExpressionNode", node.getExpressionNode(), is((IASNode)null));
+	}
+
+	@Test
+	public void MXMLRegExpNode_empty3()
+	{
+		String code = "<fx:RegExp> \t\r\n</fx:RegExp>";
+		IMXMLRegExpNode node = getMXMLRegExpNode(code);
+		assertThat("getExpressionNode", node.getExpressionNode(), is((IASNode)null));
+	}
+}

Propchange: incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLRegExpNodeTests.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLStringNodeTests.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLStringNodeTests.java?rev=1400567&view=auto
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLStringNodeTests.java
(added)
+++ incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLStringNodeTests.java
Sun Oct 21 03:46:25 2012
@@ -0,0 +1,53 @@
+package org.apache.flex.compiler.internal.tree.mxml;
+
+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.mxml.IMXMLFileNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLStringNode;
+import org.junit.Test;
+
+/**
+ * JUnit tests for {@link MXMLStringNode}.
+ * 
+ * @author Gordon Smith
+ */
+public class MXMLStringNodeTests extends MXMLExpressionNodeBaseTests
+{
+	private IMXMLStringNode getMXMLStringNode(String code)
+	{
+		IMXMLFileNode fileNode = getMXMLFileNode(code);
+		IMXMLStringNode node = (IMXMLStringNode)findFirstDescendantOfType(fileNode, IMXMLStringNode.class);
+		assertThat("getNodeID", node.getNodeID(), is(ASTNodeID.MXMLStringID));
+		assertThat("getName", node.getName(), is("String"));
+		return node;
+	}
+	
+	@Test
+	public void MXMLStringNode_empty1()
+	{
+		String code = "<fx:String/>";
+		IMXMLStringNode node = getMXMLStringNode(code);
+		assertThat("getValue", node.getValue(), is((String)null));
+		//assertThat("getExpressionNode", node.getExpressionNode(), is((IASNode)null));
+	}
+	
+	@Test
+	public void MXMLStringNode_empty2()
+	{
+		String code = "<fx:String></fx:String>";
+		IMXMLStringNode node = getMXMLStringNode(code);
+		assertThat("getValue", node.getValue(), is((String)null));
+		//assertThat("getExpressionNode", node.getExpressionNode(), is((IASNode)null));
+	}
+
+	@Test
+	public void MXMLStringNode_empty3()
+	{
+		String code = "<fx:String> \t\r\n</fx:String>";
+		IMXMLStringNode node = getMXMLStringNode(code);
+		assertThat("getValue", node.getValue(), is((String)null));
+		//assertThat("getExpressionNode", node.getExpressionNode(), is((IASNode)null));
+	}
+}

Propchange: incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLStringNodeTests.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 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=1400567&view=auto
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLUintNodeTests.java
(added)
+++ incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLUintNodeTests.java
Sun Oct 21 03:46:25 2012
@@ -0,0 +1,53 @@
+package org.apache.flex.compiler.internal.tree.mxml;
+
+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.mxml.IMXMLFileNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLUintNode;
+import org.junit.Test;
+
+/**
+ * JUnit tests for {@link MXMLUintNode}.
+ * 
+ * @author Gordon Smith
+ */
+public class MXMLUintNodeTests extends MXMLExpressionNodeBaseTests
+{
+	private IMXMLUintNode getMXMLUintNode(String code)
+	{
+		IMXMLFileNode fileNode = getMXMLFileNode(code);
+		IMXMLUintNode node = (IMXMLUintNode)findFirstDescendantOfType(fileNode, IMXMLUintNode.class);
+		assertThat("getNodeID", node.getNodeID(), is(ASTNodeID.MXMLUintID));
+		assertThat("getName", node.getName(), is("uint"));
+		return node;
+	}
+	
+	@Test
+	public void MXMLUintNode_empty1()
+	{
+		String code = "<fx:uint/>";
+		IMXMLUintNode node = getMXMLUintNode(code);
+		assertThat("getValue", node.getValue(), is(0L));
+		//assertThat("getExpressionNode", node.getExpressionNode(), is((IASNode)null));
+	}
+	
+	@Test
+	public void MXMLUintNode_empty2()
+	{
+		String code = "<fx:uint></fx:uint>";
+		IMXMLUintNode node = getMXMLUintNode(code);
+		assertThat("getValue", node.getValue(), is(0L));
+		//assertThat("getExpressionNode", node.getExpressionNode(), is((IASNode)null));
+	}
+
+	@Test
+	public void MXMLUintNode_empty3()
+	{
+		String code = "<fx:uint> \t\r\n</fx:uint>";
+		IMXMLUintNode node = getMXMLUintNode(code);
+		assertThat("getValue", node.getValue(), is(0L));
+		//assertThat("getExpressionNode", node.getExpressionNode(), is((IASNode)null));
+	}
+}

Propchange: incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLUintNodeTests.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message