flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gordonsm...@apache.org
Subject svn commit: r1405145 - in /incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml: MXMLArrayNodeTests.java MXMLObjectNodeTests.java MXMLVectorNodeTests.java MXMLXMLListNodeTests.java MXMLXMLNodeTests.java
Date Fri, 02 Nov 2012 20:31:07 GMT
Author: gordonsmith
Date: Fri Nov  2 20:31:07 2012
New Revision: 1405145

URL: http://svn.apache.org/viewvc?rev=1405145&view=rev
Log:
Falcon: Added JUnit files for testing the parsing of <Array>, <Object>, <Vector>,
<XML>, and <XMLList> tags. Currently the tests for these tags only test that empty
tags represent a null value, which isn't very interesting.

Added:
    incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLArrayNodeTests.java
  (with props)
    incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLObjectNodeTests.java
  (with props)
    incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLVectorNodeTests.java
  (with props)
    incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLXMLListNodeTests.java
  (with props)
    incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLXMLNodeTests.java
  (with props)

Added: incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLArrayNodeTests.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLArrayNodeTests.java?rev=1405145&view=auto
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLArrayNodeTests.java
(added)
+++ incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLArrayNodeTests.java
Fri Nov  2 20:31:07 2012
@@ -0,0 +1,69 @@
+/*
+ *
+ *  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.IMXMLArrayNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLFileNode;
+import org.junit.Test;
+
+/**
+ * JUnit tests for {@link MXMLArrayNode}.
+ * 
+ * @author Gordon Smith
+ */
+public class MXMLArrayNodeTests extends MXMLInstanceNodeTests
+{
+	private IMXMLArrayNode getMXMLArrayNode(String code)
+	{
+		IMXMLFileNode fileNode = getMXMLFileNode(code);
+		IMXMLArrayNode node = (IMXMLArrayNode)findFirstDescendantOfType(fileNode, IMXMLArrayNode.class);
+		assertThat("getNodeID", node.getNodeID(), is(ASTNodeID.MXMLArrayID));
+		assertThat("getName", node.getName(), is("Array"));
+		return node;
+	}
+	
+	@Test
+	public void MXMLArrayNode_empty1()
+	{
+		String code = "<fx:Array/>";
+		IMXMLArrayNode node = getMXMLArrayNode(code);
+		assertThat("getChildCount", node.getChildCount(), is(0));
+	}
+	
+	@Test
+	public void MXMLArrayNode_empty2()
+	{
+		String code = "<fx:Array></fx:Array>";
+		IMXMLArrayNode node = getMXMLArrayNode(code);
+		assertThat("getChildCount", node.getChildCount(), is(0));
+	}
+	
+	@Test
+	public void MXMLArrayNode_empty3()
+	{
+		String code = "<fx:Array> \t\r\n</fx:Array>";
+		IMXMLArrayNode node = getMXMLArrayNode(code);
+		assertThat("getChildCount", node.getChildCount(), is(0));
+	}
+}

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

Added: incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLObjectNodeTests.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLObjectNodeTests.java?rev=1405145&view=auto
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLObjectNodeTests.java
(added)
+++ incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLObjectNodeTests.java
Fri Nov  2 20:31:07 2012
@@ -0,0 +1,69 @@
+/*
+ *
+ *  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.IMXMLObjectNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLFileNode;
+import org.junit.Test;
+
+/**
+ * JUnit tests for {@link MXMLObjectNode}.
+ * 
+ * @author Gordon Smith
+ */
+public class MXMLObjectNodeTests extends MXMLInstanceNodeTests
+{
+	private IMXMLObjectNode getMXMLObjectNode(String code)
+	{
+		IMXMLFileNode fileNode = getMXMLFileNode(code);
+		IMXMLObjectNode node = (IMXMLObjectNode)findFirstDescendantOfType(fileNode, IMXMLObjectNode.class);
+		assertThat("getNodeID", node.getNodeID(), is(ASTNodeID.MXMLObjectID));
+		assertThat("getName", node.getName(), is("Object"));
+		return node;
+	}
+	
+	@Test
+	public void MXMLObjectNode_empty1()
+	{
+		String code = "<fx:Object/>";
+		IMXMLObjectNode node = getMXMLObjectNode(code);
+		assertThat("getChildCount", node.getChildCount(), is(0));
+	}
+	
+	@Test
+	public void MXMLObjectNode_empty2()
+	{
+		String code = "<fx:Object></fx:Object>";
+		IMXMLObjectNode node = getMXMLObjectNode(code);
+		assertThat("getChildCount", node.getChildCount(), is(0));
+	}
+	
+	@Test
+	public void MXMLObjectNode_empty3()
+	{
+		String code = "<fx:Object> \t\r\n</fx:Object>";
+		IMXMLObjectNode node = getMXMLObjectNode(code);
+		assertThat("getChildCount", node.getChildCount(), is(0));
+	}
+}

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

Added: incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLVectorNodeTests.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLVectorNodeTests.java?rev=1405145&view=auto
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLVectorNodeTests.java
(added)
+++ incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLVectorNodeTests.java
Fri Nov  2 20:31:07 2012
@@ -0,0 +1,69 @@
+/*
+ *
+ *  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.IMXMLVectorNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLFileNode;
+import org.junit.Test;
+
+/**
+ * JUnit tests for {@link MXMLVectorNode}.
+ * 
+ * @author Gordon Smith
+ */
+public class MXMLVectorNodeTests extends MXMLInstanceNodeTests
+{
+	private IMXMLVectorNode getMXMLVectorNode(String code)
+	{
+		IMXMLFileNode fileNode = getMXMLFileNode(code);
+		IMXMLVectorNode node = (IMXMLVectorNode)findFirstDescendantOfType(fileNode, IMXMLVectorNode.class);
+		assertThat("getNodeID", node.getNodeID(), is(ASTNodeID.MXMLVectorID));
+		assertThat("getName", node.getName(), is("Vector"));
+		return node;
+	}
+	
+	@Test
+	public void MXMLVectorNode_empty1()
+	{
+		String code = "<fx:Vector/>";
+		IMXMLVectorNode node = getMXMLVectorNode(code);
+		assertThat("getChildCount", node.getChildCount(), is(0));
+	}
+	
+	@Test
+	public void MXMLVectorNode_empty2()
+	{
+		String code = "<fx:Vector></fx:Vector>";
+		IMXMLVectorNode node = getMXMLVectorNode(code);
+		assertThat("getChildCount", node.getChildCount(), is(0));
+	}
+	
+	@Test
+	public void MXMLVectorNode_empty3()
+	{
+		String code = "<fx:Vector> \t\r\n</fx:Vector>";
+		IMXMLVectorNode node = getMXMLVectorNode(code);
+		assertThat("getChildCount", node.getChildCount(), is(0));
+	}
+}

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

Added: incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLXMLListNodeTests.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLXMLListNodeTests.java?rev=1405145&view=auto
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLXMLListNodeTests.java
(added)
+++ incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLXMLListNodeTests.java
Fri Nov  2 20:31:07 2012
@@ -0,0 +1,69 @@
+/*
+ *
+ *  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.IMXMLXMLListNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLFileNode;
+import org.junit.Test;
+
+/**
+ * JUnit tests for {@link MXMLXMLListNode}.
+ * 
+ * @author Gordon Smith
+ */
+public class MXMLXMLListNodeTests extends MXMLInstanceNodeTests
+{
+	private IMXMLXMLListNode getMXMLXMLListNode(String code)
+	{
+		IMXMLFileNode fileNode = getMXMLFileNode(code);
+		IMXMLXMLListNode node = (IMXMLXMLListNode)findFirstDescendantOfType(fileNode, IMXMLXMLListNode.class);
+		assertThat("getNodeID", node.getNodeID(), is(ASTNodeID.MXMLXMLListID));
+		assertThat("getName", node.getName(), is("XMLList"));
+		return node;
+	}
+	
+	@Test
+	public void MXMLXMLListNode_empty1()
+	{
+		String code = "<fx:XMLList/>";
+		IMXMLXMLListNode node = getMXMLXMLListNode(code);
+		assertThat("getChildCount", node.getChildCount(), is(0));
+	}
+	
+	@Test
+	public void MXMLXMLListNode_empty2()
+	{
+		String code = "<fx:XMLList></fx:XMLList>";
+		IMXMLXMLListNode node = getMXMLXMLListNode(code);
+		assertThat("getChildCount", node.getChildCount(), is(0));
+	}
+	
+	@Test
+	public void MXMLXMLListNode_empty3()
+	{
+		String code = "<fx:XMLList> \t\r\n</fx:XMLList>";
+		IMXMLXMLListNode node = getMXMLXMLListNode(code);
+		assertThat("getChildCount", node.getChildCount(), is(0));
+	}
+}

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

Added: incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLXMLNodeTests.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLXMLNodeTests.java?rev=1405145&view=auto
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLXMLNodeTests.java
(added)
+++ incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLXMLNodeTests.java
Fri Nov  2 20:31:07 2012
@@ -0,0 +1,69 @@
+/*
+ *
+ *  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.IMXMLXMLNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLFileNode;
+import org.junit.Test;
+
+/**
+ * JUnit tests for {@link MXMLXMLNode}.
+ * 
+ * @author Gordon Smith
+ */
+public class MXMLXMLNodeTests extends MXMLInstanceNodeTests
+{
+	private IMXMLXMLNode getMXMLXMLNode(String code)
+	{
+		IMXMLFileNode fileNode = getMXMLFileNode(code);
+		IMXMLXMLNode node = (IMXMLXMLNode)findFirstDescendantOfType(fileNode, IMXMLXMLNode.class);
+		assertThat("getNodeID", node.getNodeID(), is(ASTNodeID.MXMLXMLID));
+		assertThat("getName", node.getName(), is("XML"));
+		return node;
+	}
+	
+	@Test
+	public void MXMLXMLNode_empty1()
+	{
+		String code = "<fx:XML/>";
+		IMXMLXMLNode node = getMXMLXMLNode(code);
+		assertThat("getChildCount", node.getChildCount(), is(0));
+	}
+	
+	@Test
+	public void MXMLXMLNode_empty2()
+	{
+		String code = "<fx:XML></fx:XML>";
+		IMXMLXMLNode node = getMXMLXMLNode(code);
+		assertThat("getChildCount", node.getChildCount(), is(0));
+	}
+	
+	@Test
+	public void MXMLXMLNode_empty3()
+	{
+		String code = "<fx:XML> \t\r\n</fx:XML>";
+		IMXMLXMLNode node = getMXMLXMLNode(code);
+		assertThat("getChildCount", node.getChildCount(), is(0));
+	}
+}

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



Mime
View raw message