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 2013/01/31 23:16:43 UTC

svn commit: r1441223 - in /flex/falcon/trunk: compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/ compiler/src/org/apache/flex/compiler/internal/tree/mxml/ compiler/src/org/apache/flex/compiler/tree/mxml/

Author: gordonsmith
Date: Thu Jan 31 22:16:42 2013
New Revision: 1441223

URL: http://svn.apache.org/viewvc?rev=1441223&view=rev
Log:
Falcon unit tests: Add parsing tests that create

MXMLBindingNode, which represents a <Binding> tag
MXMLDesignLayerNode, which represents a <DesignLayer> tag
MXMLImplementsNode, which represents an implements='...' attribute on a class definition tag)
MXMLPrivateNode, which represents a <Private> tag)
MXMLResourceNode, which represents a @Resource(bundle="...", key="...") compiler directive

Added:
    flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLBindingNodeTests.java   (with props)
    flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLDesignLayerNodeTests.java   (with props)
    flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLImplementsNodeTests.java   (with props)
    flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLPrivateNodeTests.java   (with props)
    flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLResourceNodeTests.java   (with props)
Modified:
    flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLCompilerDirectiveParser.java
    flex/falcon/trunk/compiler/src/org/apache/flex/compiler/tree/mxml/IMXMLImplementsNode.java

Added: flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLBindingNodeTests.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLBindingNodeTests.java?rev=1441223&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLBindingNodeTests.java (added)
+++ flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLBindingNodeTests.java Thu Jan 31 22:16:42 2013
@@ -0,0 +1,191 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+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.IMXMLBindingAttributeNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLBindingNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLFileNode;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * JUnit tests for {@link MXMLBindingNode} and {@link MXMLBindingAttributeNode}.
+ * 
+ * @author Gordon Smith
+ */
+public class MXMLBindingNodeTests extends MXMLNodeBaseTests
+{
+	private IMXMLBindingNode getMXMLBindingNode(String[] code)
+	{
+		IMXMLFileNode fileNode = getMXMLFileNode(code);
+		IMXMLBindingNode node = (IMXMLBindingNode)findFirstDescendantOfType(fileNode, IMXMLBindingNode.class);
+		assertThat("getNodeID", node.getNodeID(), is(ASTNodeID.MXMLBindingID));
+		assertThat("getName", node.getName(), is("Binding"));
+		return node;
+	}
+	
+	@Test
+	public void MXMLBindingNode_empty1()
+	{
+		String[] code = new String[]
+		{
+			"<fx:Binding/>"
+		};
+		IMXMLBindingNode node = getMXMLBindingNode(code);
+		assertThat("getChildCount", node.getChildCount(), is(0));
+		assertThat("getSourceAttributeNode", node.getSourceAttributeNode(), is((IMXMLBindingAttributeNode)null));
+		assertThat("getDestinationAttributeNode", node.getDestinationAttributeNode(), is((IMXMLBindingAttributeNode)null));
+		assertThat("getTwoWay", node.getTwoWay(), is(false));
+	}
+	
+	@Test
+	public void MXMLBindingNode_empty2()
+	{
+		String[] code = new String[]
+		{
+			"<fx:Binding></fx:Binding>"
+		};
+		IMXMLBindingNode node = getMXMLBindingNode(code);
+		assertThat("getChildCount", node.getChildCount(), is(0));
+		assertThat("getSourceAttributeNode", node.getSourceAttributeNode(), is((IMXMLBindingAttributeNode)null));
+		assertThat("getDestinationAttributeNode", node.getDestinationAttributeNode(), is((IMXMLBindingAttributeNode)null));
+		assertThat("getTwoWay", node.getTwoWay(), is(false));
+	}
+	
+	@Test
+	public void MXMLBindingNode_empty3()
+	{
+		String[] code = new String[]
+		{
+			"<fx:Binding> \t\r\n</fx:Binding>"
+		};
+		IMXMLBindingNode node = getMXMLBindingNode(code);
+		assertThat("getChildCount", node.getChildCount(), is(0));
+		assertThat("getSourceAttributeNode", node.getSourceAttributeNode(), is((IMXMLBindingAttributeNode)null));
+		assertThat("getDestinationAttributeNode", node.getDestinationAttributeNode(), is((IMXMLBindingAttributeNode)null));
+		assertThat("getTwoWay", node.getTwoWay(), is(false));
+	}
+	
+	@Test
+	public void MXMLBindingNode_source()
+	{
+		String[] code = new String[]
+		{
+			"<fx:Binding source=' a.b '/>"
+		};
+		IMXMLBindingNode node = getMXMLBindingNode(code);
+		assertThat("getChildCount", node.getChildCount(), is(1));
+		assertThat("getSourceAttributeNode", node.getSourceAttributeNode(), is((IMXMLBindingAttributeNode)node.getChild(0)));
+		assertThat("getSourceAttributeNode.getExpressionNode.getNodeID", node.getSourceAttributeNode().getExpressionNode().getNodeID(), is(ASTNodeID.MemberAccessExpressionID));
+		assertThat("getDestinationAttributeNode", node.getDestinationAttributeNode(), is((IMXMLBindingAttributeNode)null));
+		assertThat("getTwoWay", node.getTwoWay(), is(false));
+	}
+	
+	@Test
+	public void MXMLBindingNode_destination()
+	{
+		String[] code = new String[]
+		{
+			"<fx:Binding destination=' c.d '/>"
+		};
+		IMXMLBindingNode node = getMXMLBindingNode(code);
+		assertThat("getChildCount", node.getChildCount(), is(1));
+		assertThat("getSourceAttributeNode", node.getSourceAttributeNode(), is((IMXMLBindingAttributeNode)null));
+		assertThat("getDestinationAttributeNode", node.getDestinationAttributeNode(), is((IMXMLBindingAttributeNode)node.getChild(0)));
+		assertThat("getDestinationAttributeNode.getExpressionNode.getNodeID", node.getDestinationAttributeNode().getExpressionNode().getNodeID(), is(ASTNodeID.MemberAccessExpressionID));
+		assertThat("getTwoWay", node.getTwoWay(), is(false));
+	}
+	
+	@Test
+	public void MXMLBindingNode_twoWayFalse()
+	{
+		String[] code = new String[]
+		{
+			"<fx:Binding twoWay=' false '/>"
+		};
+		IMXMLBindingNode node = getMXMLBindingNode(code);
+		assertThat("getChildCount", node.getChildCount(), is(0));
+		assertThat("getSourceAttributeNode", node.getSourceAttributeNode(), is((IMXMLBindingAttributeNode)null));
+		assertThat("getDestinationAttributeNode", node.getSourceAttributeNode(), is((IMXMLBindingAttributeNode)null));
+		assertThat("getTwoWay", node.getTwoWay(), is(false));
+	}
+	
+	@Test
+	public void MXMLBindingNode_twoWayTrue()
+	{
+		String[] code = new String[]
+		{
+			"<fx:Binding twoWay=' true '/>"
+		};
+		IMXMLBindingNode node = getMXMLBindingNode(code);
+		assertThat("getChildCount", node.getChildCount(), is(0));
+		assertThat("getSourceAttributeNode", node.getSourceAttributeNode(), is((IMXMLBindingAttributeNode)null));
+		assertThat("getDestinationAttributeNode", node.getSourceAttributeNode(), is((IMXMLBindingAttributeNode)null));
+		assertThat("getTwoWay", node.getTwoWay(), is(true));
+	}
+	
+	@Test
+	public void MXMLBindingNode_source_destination_twoWayTrue()
+	{
+		String[] code = new String[]
+		{
+			"<fx:Binding source=' a.b ' destination=' c.d ' twoWay=' true '/>"
+		};
+		IMXMLBindingNode node = getMXMLBindingNode(code);
+		assertThat("getChildCount", node.getChildCount(), is(2));
+		assertThat("getSourceAttributeNode", node.getSourceAttributeNode(), is((IMXMLBindingAttributeNode)node.getChild(0)));
+		assertThat("getSourceAttributeNode.getExpressionNode.getNodeID", node.getSourceAttributeNode().getExpressionNode().getNodeID(), is(ASTNodeID.MemberAccessExpressionID));
+		assertThat("getDestinationAttributeNode", node.getDestinationAttributeNode(), is((IMXMLBindingAttributeNode)node.getChild(1)));
+		assertThat("getDestinationAttributeNode.getExpressionNode.getNodeID", node.getDestinationAttributeNode().getExpressionNode().getNodeID(), is(ASTNodeID.MemberAccessExpressionID));
+		assertThat("getTwoWay", node.getTwoWay(), is(true));
+	}
+	
+	@Test
+	public void MXMLBindingNode_destination_twoWayFalse_source()
+	{
+		String[] code = new String[]
+		{
+			"<fx:Binding destination=' c.d ' twoWay=' false ' source=' a.b '/>"
+		};
+		IMXMLBindingNode node = getMXMLBindingNode(code);
+		assertThat("getChildCount", node.getChildCount(), is(2));
+		assertThat("getSourceAttributeNode", node.getSourceAttributeNode(), is((IMXMLBindingAttributeNode)node.getChild(1)));
+		assertThat("getSourceAttributeNode.getExpressionNode.getNodeID", node.getSourceAttributeNode().getExpressionNode().getNodeID(), is(ASTNodeID.MemberAccessExpressionID));
+		assertThat("getDestinationAttributeNode", node.getDestinationAttributeNode(), is((IMXMLBindingAttributeNode)node.getChild(0)));
+		assertThat("getDestinationAttributeNode.getExpressionNode.getNodeID", node.getDestinationAttributeNode().getExpressionNode().getNodeID(), is(ASTNodeID.MemberAccessExpressionID));
+		assertThat("getTwoWay", node.getTwoWay(), is(false));
+	}
+	
+	@Ignore
+	@Test
+	public void MXMLBindingNode_text()
+	{
+		String[] code = new String[]
+		{
+			"<fx:Binding> a.b </fx:Binding>"
+		};
+		IMXMLBindingNode node = getMXMLBindingNode(code);
+		assertThat("getChildCount", node.getChildCount(), is(0));
+	}
+}

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

Added: flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLDesignLayerNodeTests.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLDesignLayerNodeTests.java?rev=1441223&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLDesignLayerNodeTests.java (added)
+++ flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLDesignLayerNodeTests.java Thu Jan 31 22:16:42 2013
@@ -0,0 +1,117 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+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.IMXMLDesignLayerNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLFileNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLPropertySpecifierNode;
+import org.junit.Test;
+
+/**
+ * JUnit tests for {@link MXMLDesignLayerNode}.
+ * 
+ * @author Gordon Smith
+ */
+public class MXMLDesignLayerNodeTests extends MXMLInstanceNodeTests
+{
+	private IMXMLDesignLayerNode getMXMLDesignLayerNode(String[] code)
+	{
+		IMXMLFileNode fileNode = getMXMLFileNode(code);
+		IMXMLDesignLayerNode node = (IMXMLDesignLayerNode)findFirstDescendantOfType(fileNode, IMXMLDesignLayerNode.class);
+		assertThat("getNodeID", node.getNodeID(), is(ASTNodeID.MXMLDesignLayerID));
+		assertThat("getName", node.getName(), is("DesignLayer"));
+		return node;
+	}
+	
+	@Test
+	public void MXMLDesignLayerNode_empty1()
+	{
+		String[] code = new String[]
+		{
+			"<fx:DesignLayer/>"
+		};
+		IMXMLDesignLayerNode node = getMXMLDesignLayerNode(code);
+		assertThat("getChildCount", node.getChildCount(), is(0));
+		assertThat("getHoistedChildCount", node.getHoistedChildCount(), is(0));
+		assertThat("skipCodeGeneration", node.skipCodeGeneration(), is(true));
+	}
+	
+	@Test
+	public void MXMLDesignLayerNode_empty2()
+	{
+		String[] code = new String[]
+		{
+			"<fx:DesignLayer></fx:DesignLayer>"
+		};
+		IMXMLDesignLayerNode node = getMXMLDesignLayerNode(code);
+		assertThat("getChildCount", node.getChildCount(), is(0));
+		assertThat("getHoistedChildCount", node.getHoistedChildCount(), is(0));
+		assertThat("skipCodeGeneration", node.skipCodeGeneration(), is(true));
+	}
+	
+	@Test
+	public void MXMLDesignLayerNode_empty3()
+	{
+		String[] code = new String[]
+		{
+			"<fx:DesignLayer> \t\r\n</fx:DesignLayer>"
+		};
+		IMXMLDesignLayerNode node = getMXMLDesignLayerNode(code);
+		assertThat("getChildCount", node.getChildCount(), is(0));
+		assertThat("getHoistedChildCount", node.getHoistedChildCount(), is(0));
+		assertThat("skipCodeGeneration", node.skipCodeGeneration(), is(true));
+	}
+	
+	@Test
+	public void MXMLDesignLayerNode_id_visible_alpha()
+	{
+		String[] code = new String[]
+		{
+			"<fx:DesignLayer id=' dl1 ' visible=' false ' alpha=' 0.5 '/>"
+		};
+		IMXMLDesignLayerNode node = getMXMLDesignLayerNode(code);
+		assertThat("getChildCount", node.getChildCount(), is(2)); // visible and alpha property nodes
+		assertThat("getHoistedChildCount", node.getHoistedChildCount(), is(0));
+		assertThat("skipCodeGeneration", node.skipCodeGeneration(), is(false));
+		assertThat("getID", node.getID(), is("dl1"));
+		assertThat("getChild(0).getName()", ((IMXMLPropertySpecifierNode)node.getChild(0)).getName(), is("visible"));
+		assertThat("getChild(0).getName()", ((IMXMLPropertySpecifierNode)node.getChild(1)).getName(), is("alpha"));
+	}
+	
+	@Test
+	public void MXMLDesignLayerNode_two_children()
+	{
+		String[] code = new String[]
+		{
+			"<fx:DesignLayer>",
+			"    <d:Sprite/>",
+			"    <d:Sprite/>",
+			"</fx:DesignLayer>"
+		};
+		IMXMLDesignLayerNode node = getMXMLDesignLayerNode(code);
+		assertThat("getChildCount", node.getChildCount(), is(2));
+		assertThat("getHoistedChildCount", node.getHoistedChildCount(), is(2));
+		assertThat("skipCodeGeneration", node.skipCodeGeneration(), is(true));
+	}
+}

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

Added: flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLImplementsNodeTests.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLImplementsNodeTests.java?rev=1441223&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLImplementsNodeTests.java (added)
+++ flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLImplementsNodeTests.java Thu Jan 31 22:16:42 2013
@@ -0,0 +1,106 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+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.IIdentifierNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLImplementsNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLFileNode;
+import org.apache.flex.utils.StringUtils;
+import org.junit.Test;
+
+/**
+ * JUnit tests for {@link MXMLImplementsNode}.
+ * 
+ * @author Gordon Smith
+ */
+public class MXMLImplementsNodeTests extends MXMLNodeBaseTests
+{
+	@Override
+ 	protected String[] getTemplate()
+	{
+ 		// Tests of nodes for class-definition-level tags like <Declarations>,
+ 		// <Library>,  <Metadata>, <Script>, and <Style> use this document template.
+ 		// Tests for nodes produced by tags that appear at other locations
+ 		// override getTemplate() and getMXML().
+		return new String[] 
+		{
+		    "<d:Sprite xmlns:fx='http://ns.adobe.com/mxml/2009'",
+		    "          xmlns:d='flash.display.*'",
+		    "          %1",
+		    "</d:Sprite>"
+		};
+    };
+	
+	protected String getMXML(String[] code)
+    {
+        String mxml = StringUtils.join(getTemplate(), "\n");
+        mxml = mxml.replace("%1", StringUtils.join(code, ", "));
+        return mxml;
+    }
+	    
+	private IMXMLImplementsNode getMXMLImplementsNode(String[] code)
+	{
+		IMXMLFileNode fileNode = getMXMLFileNode(code);
+		IMXMLImplementsNode node = (IMXMLImplementsNode)findFirstDescendantOfType(fileNode, IMXMLImplementsNode.class);
+		assertThat("getNodeID", node.getNodeID(), is(ASTNodeID.MXMLImplementsID));
+		assertThat("getName", node.getName(), is("implements"));
+		return node;
+	}
+	
+	@Test
+	public void MXMLImplementsNode_oneInterfaceWithSimpleName()
+	{
+		String[] code = new String[]
+		{
+			"implements=' I1 '"
+		};
+		IMXMLImplementsNode node = getMXMLImplementsNode(code);
+		assertThat("getChildCount", node.getChildCount(), is(1));
+		assertThat("getInterfaceNodes.length", node.getInterfaceNodes().length, is(1));
+		IIdentifierNode interfaceNode0 = node.getInterfaceNodes()[0];
+		assertThat("interfaceNode0", interfaceNode0, is(node.getChild(0)));
+		assertThat("interfaceNode0.getNodeID", interfaceNode0.getNodeID(), is(ASTNodeID.IdentifierID));
+		assertThat("interfaceNode0.getName", interfaceNode0.getName(), is("I1"));
+	}
+	
+	@Test
+	public void MXMLImplementsNode_twoInterfacesWithQNames()
+	{
+		String[] code = new String[]
+		{
+			"implements=' a.b.I1 , c.d.I2 '"
+		};
+		IMXMLImplementsNode node = getMXMLImplementsNode(code);
+		assertThat("getChildCount", node.getChildCount(), is(2));
+		assertThat("getInterfaceNodes.length", node.getInterfaceNodes().length, is(2));
+		IIdentifierNode interfaceNode0 = node.getInterfaceNodes()[0];
+		assertThat("interfaceNode0", interfaceNode0, is(node.getChild(0)));
+		assertThat("interfaceNode0.getNodeID", interfaceNode0.getNodeID(), is(ASTNodeID.FullNameID));
+		assertThat("interfaceNode0.getName", interfaceNode0.getName(), is("a.b.I1"));
+		IIdentifierNode interfaceNode1 = node.getInterfaceNodes()[1];
+		assertThat("interfaceNode1", interfaceNode1, is(node.getChild(1)));
+		assertThat("interfaceNode1.getNodeID", interfaceNode1.getNodeID(), is(ASTNodeID.FullNameID));
+		assertThat("interfaceNode1.getName", interfaceNode1.getName(), is("c.d.I2"));
+	}
+}

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

Added: flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLPrivateNodeTests.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLPrivateNodeTests.java?rev=1441223&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLPrivateNodeTests.java (added)
+++ flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLPrivateNodeTests.java Thu Jan 31 22:16:42 2013
@@ -0,0 +1,104 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+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.IMXMLPrivateNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLFileNode;
+import org.junit.Test;
+
+/**
+ * JUnit tests for {@link MXMLPrivateNode}.
+ * 
+ * @author Gordon Smith
+ */
+public class MXMLPrivateNodeTests extends MXMLNodeBaseTests
+{
+	private IMXMLPrivateNode getMXMLPrivateNode(String[] code)
+	{
+		IMXMLFileNode fileNode = getMXMLFileNode(code);
+		IMXMLPrivateNode node = (IMXMLPrivateNode)findFirstDescendantOfType(fileNode, IMXMLPrivateNode.class);
+		assertThat("getNodeID", node.getNodeID(), is(ASTNodeID.MXMLPrivateID));
+		assertThat("getName", node.getName(), is("Private"));
+		assertThat("getChildCount", node.getChildCount(), is(0));
+		return node;
+	}
+	
+	@Test
+	public void MXMLPrivateNode_empty1()
+	{
+		String[] code = new String[]
+		{
+			"<fx:Private/>"
+		};
+		getMXMLPrivateNode(code);
+	}
+	
+	@Test
+	public void MXMLPrivateNode_empty2()
+	{
+		String[] code = new String[]
+		{
+			"<fx:Private></fx:Private>"
+		};
+		getMXMLPrivateNode(code);
+	}
+	
+	@Test
+	public void MXMLPrivateNode_empty3()
+	{
+		String[] code = new String[]
+		{
+			"<fx:Private> \t\r\n</fx:Private>"
+		};
+		getMXMLPrivateNode(code);
+	}
+	
+	@Test
+	public void MXMLPrivateNode_text()
+	{
+		String[] code = new String[]
+		{
+			"<fx:Private>abc<fx:Private>"
+		};
+		getMXMLPrivateNode(code);
+	}
+	
+	@Test
+	public void MXMLPrivateNode_tags()
+	{
+		String[] code = new String[]
+		{
+			"<fx:Private>",
+			"   <a>",
+			"      <b c='1'/>",
+			"   </a>" +
+			"   <a>" +
+			"      <b c='1'/>",
+			"   </a>",
+			"",
+			"<fx:Private>"
+		};
+		getMXMLPrivateNode(code);
+	}
+}

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

Added: flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLResourceNodeTests.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLResourceNodeTests.java?rev=1441223&view=auto
==============================================================================
--- flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLResourceNodeTests.java (added)
+++ flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLResourceNodeTests.java Thu Jan 31 22:16:42 2013
@@ -0,0 +1,127 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+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.constants.IASLanguageConstants.BuiltinType;
+import org.apache.flex.compiler.tree.ASTNodeID;
+import org.apache.flex.compiler.tree.mxml.IMXMLResourceNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLFileNode;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * JUnit tests for {@link MXMLResourceNode}.
+ * 
+ * @author Gordon Smith
+ */
+public class MXMLResourceNodeTests extends MXMLInstanceNodeTests
+{
+	private IMXMLResourceNode getMXMLResourceNode(String[] code)
+	{
+		IMXMLFileNode fileNode = getMXMLFileNode(code);
+		IMXMLResourceNode node = (IMXMLResourceNode)findFirstDescendantOfType(fileNode, IMXMLResourceNode.class);
+		assertThat("getNodeID", node.getNodeID(), is(ASTNodeID.MXMLResourceID));
+		assertThat("getName", node.getName(), is("Resource"));
+		assertThat("getChildCount", node.getChildCount(), is(0));
+		return node;
+	}
+	
+	@Test
+	public void MXMLResourceNode_Boolean()
+	{
+		String[] code = new String[]
+		{
+			"<fx:Boolean> @Resource(bundle='b1', key='k1') </fx:Boolean>"
+		};
+		IMXMLResourceNode node = getMXMLResourceNode(code);
+		assertThat("getBundleName", node.getBundleName(), is("b1"));
+		assertThat("getKey", node.getKey(), is("k1"));
+		assertThat("getType", node.getType(), is(project.getBuiltinType(BuiltinType.BOOLEAN)));
+	}
+	
+	@Test
+	public void MXMLResourceNode_int()
+	{
+		String[] code = new String[]
+		{
+			"<fx:int> @Resource(bundle='b1', key='k1') </fx:int>"
+		};
+		IMXMLResourceNode node = getMXMLResourceNode(code);
+		assertThat("getBundleName", node.getBundleName(), is("b1"));
+		assertThat("getKey", node.getKey(), is("k1"));
+		assertThat("getType", node.getType(), is(project.getBuiltinType(BuiltinType.INT)));
+	}
+	
+	@Test
+	public void MXMLResourceNode_uint()
+	{
+		String[] code = new String[]
+		{
+			"<fx:uint> @Resource(bundle='b1', key='k1') </fx:uint>"
+		};
+		IMXMLResourceNode node = getMXMLResourceNode(code);
+		assertThat("getBundleName", node.getBundleName(), is("b1"));
+		assertThat("getKey", node.getKey(), is("k1"));
+		assertThat("getType", node.getType(), is(project.getBuiltinType(BuiltinType.UINT)));
+	}
+	
+	@Test
+	public void MXMLResourceNode_Number()
+	{
+		String[] code = new String[]
+		{
+			"<fx:Number> @Resource(bundle='b1', key='k1') </fx:Number>"
+		};
+		IMXMLResourceNode node = getMXMLResourceNode(code);
+		assertThat("getBundleName", node.getBundleName(), is("b1"));
+		assertThat("getKey", node.getKey(), is("k1"));
+		assertThat("getType", node.getType(), is(project.getBuiltinType(BuiltinType.NUMBER)));
+	}
+	
+	@Test
+	public void MXMLResourceNode_String()
+	{
+		String[] code = new String[]
+		{
+			"<fx:String> @Resource(bundle='b1', key='k1') </fx:String>"
+		};
+		IMXMLResourceNode node = getMXMLResourceNode(code);
+		assertThat("getBundleName", node.getBundleName(), is("b1"));
+		assertThat("getKey", node.getKey(), is("k1"));
+		assertThat("getType", node.getType(), is(project.getBuiltinType(BuiltinType.STRING)));
+	}
+	
+	@Ignore
+	@Test
+	public void MXMLResourceNode_Class()
+	{
+		String[] code = new String[]
+		{
+			"<fx:Class> @Resource(bundle='b1', key='k1') </fx:Class>"
+		};
+		IMXMLResourceNode node = getMXMLResourceNode(code);
+		assertThat("getBundleName", node.getBundleName(), is("b1"));
+		assertThat("getKey", node.getKey(), is("k1"));
+		assertThat("getType", node.getType(), is(project.getBuiltinType(BuiltinType.CLASS)));
+	}
+}

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

Modified: flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLCompilerDirectiveParser.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLCompilerDirectiveParser.java?rev=1441223&r1=1441222&r2=1441223&view=diff
==============================================================================
--- flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLCompilerDirectiveParser.java (original)
+++ flex/falcon/trunk/compiler/src/org/apache/flex/compiler/internal/tree/mxml/MXMLCompilerDirectiveParser.java Thu Jan 31 22:16:42 2013
@@ -55,7 +55,8 @@ class MXMLCompilerDirectiveParser
         if (atFunctionName == null)
             return null;
 
-        return parseAtFunction(builder, parent, location, atFunctionName, text, type);
+        String trimmedText = builder.getMXMLDialect().trim(text);
+        return parseAtFunction(builder, parent, location, atFunctionName, trimmedText, type);
     }
 
     private static String getAtFunctionName(String value)

Modified: flex/falcon/trunk/compiler/src/org/apache/flex/compiler/tree/mxml/IMXMLImplementsNode.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler/src/org/apache/flex/compiler/tree/mxml/IMXMLImplementsNode.java?rev=1441223&r1=1441222&r2=1441223&view=diff
==============================================================================
--- flex/falcon/trunk/compiler/src/org/apache/flex/compiler/tree/mxml/IMXMLImplementsNode.java (original)
+++ flex/falcon/trunk/compiler/src/org/apache/flex/compiler/tree/mxml/IMXMLImplementsNode.java Thu Jan 31 22:16:42 2013
@@ -35,7 +35,7 @@ public interface IMXMLImplementsNode ext
      * Gets the identifier nodes representing the implemented interfaces; these
      * are the children of this node.
      * 
-     * @return An array of {@link IIdentifierNode} objects representign the
+     * @return An array of {@link IIdentifierNode} objects representing the
      * implemented interfaces.
      */
     IIdentifierNode[] getInterfaceNodes();