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/21 21:10:32 UTC
svn commit: r1436586 [2/2] -
/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/
Modified: flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLScriptNodeTests.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLScriptNodeTests.java?rev=1436586&r1=1436585&r2=1436586&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLScriptNodeTests.java (original)
+++ flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLScriptNodeTests.java Mon Jan 21 20:10:31 2013
@@ -34,21 +34,7 @@ import org.junit.Test;
*/
public class MXMLScriptNodeTests extends MXMLNodeBaseTests
{
- private static String PREFIX =
- "<d:Sprite xmlns:fx='http://ns.adobe.com/mxml/2009' xmlns:d='flash.display.*'>\n\t";
-
- private static String POSTFIX =
- "\n</d:Sprite>";
-
- private static String EOL = "\n\t";
-
- @Override
- protected IMXMLFileNode getMXMLFileNode(String code)
- {
- return super.getMXMLFileNode(PREFIX + code + POSTFIX);
- }
-
- private IMXMLScriptNode getMXMLScriptNode(String code)
+ private IMXMLScriptNode getMXMLScriptNode(String[] code)
{
IMXMLFileNode fileNode = getMXMLFileNode(code);
IMXMLScriptNode node = (IMXMLScriptNode)findFirstDescendantOfType(fileNode, IMXMLScriptNode.class);
@@ -60,7 +46,10 @@ public class MXMLScriptNodeTests extends
@Test
public void MXMLScriptNode_empty1()
{
- String code = "<fx:Script/>";
+ String[] code = new String[]
+ {
+ "<fx:Script/>"
+ };
IMXMLScriptNode node = getMXMLScriptNode(code);
assertThat("getChildCount", node.getChildCount(), is(0));
}
@@ -68,7 +57,10 @@ public class MXMLScriptNodeTests extends
@Test
public void MXMLScriptNode_empty2()
{
- String code = "<fx:Script></fx:Script>";
+ String[] code = new String[]
+ {
+ "<fx:Script></fx:Script>"
+ };
IMXMLScriptNode node = getMXMLScriptNode(code);
assertThat("getChildCount", node.getChildCount(), is(0));
}
@@ -76,7 +68,10 @@ public class MXMLScriptNodeTests extends
@Test
public void MXMLScriptNode_empty3()
{
- String code = "<fx:Script/> \t\r\n<fx:Script/>";
+ String[] code = new String[]
+ {
+ "<fx:Script/> \t\r\n<fx:Script/>"
+ };
IMXMLScriptNode node = getMXMLScriptNode(code);
assertThat("getChildCount", node.getChildCount(), is(0));
}
@@ -84,11 +79,13 @@ public class MXMLScriptNodeTests extends
@Test
public void MXMLScriptNode_var_and_function()
{
- String code =
- "<fx:Script>" + EOL +
- " private var i:int = 1;" + EOL +
- " private function f():void { };" + EOL +
- "</fx:Script>";
+ String[] code = new String[]
+ {
+ "<fx:Script>",
+ " private var i:int = 1;",
+ " private function f():void { };",
+ "</fx:Script>"
+ };
IMXMLScriptNode node = getMXMLScriptNode(code);
assertThat("getChildCount", node.getChildCount(), is(2));
assertThat("child 0", node.getChild(0).getNodeID(), is(ASTNodeID.VariableID));
Modified: flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLStateNodeTests.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLStateNodeTests.java?rev=1436586&r1=1436585&r2=1436586&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLStateNodeTests.java (original)
+++ flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLStateNodeTests.java Mon Jan 21 20:10:31 2013
@@ -25,6 +25,7 @@ import static org.junit.Assert.assertTha
import org.apache.flex.compiler.tree.ASTNodeID;
import org.apache.flex.compiler.tree.mxml.IMXMLFileNode;
import org.apache.flex.compiler.tree.mxml.IMXMLStateNode;
+import org.apache.flex.utils.StringUtils;
import org.junit.Test;
/**
@@ -35,18 +36,20 @@ import org.junit.Test;
public class MXMLStateNodeTests extends MXMLInstanceNodeTests
{
@Override
- protected String getPrefix()
+ protected String[] getTemplate()
{
- return "";
+ return new String[]
+ {
+ };
}
@Override
- protected String getPostfix()
- {
- return "";
- }
-
- private IMXMLStateNode getMXMLStateNode(String code)
+ protected String getMXML(String[] code)
+ {
+ return StringUtils.join(code, "\n");
+ }
+
+ private IMXMLStateNode getMXMLStateNode(String[] code)
{
IMXMLFileNode fileNode = getMXMLFileNode(code);
IMXMLStateNode node = (IMXMLStateNode)findFirstDescendantOfType(fileNode, IMXMLStateNode.class);
@@ -58,12 +61,14 @@ public class MXMLStateNodeTests extends
@Test
public void MXMLStateNode_oneState()
{
- String code =
- "<s:Application xmlns:fx='http://ns.adobe.com/mxml/2009' xmlns:s='library://ns.adobe.com/flex/spark'>\n" +
- " <s:states>\n" +
- " <s:State name='s1' stateGroups='g1, g2' enterState='trace()' exitState='trace()'/>\n" +
- " </s:states>\n" +
- "</s:Application>";
+ String[] code = new String[]
+ {
+ "<s:Application xmlns:fx='http://ns.adobe.com/mxml/2009' xmlns:s='library://ns.adobe.com/flex/spark'>",
+ " <s:states>",
+ " <s:State name='s1' stateGroups='g1, g2' enterState='trace()' exitState='trace()'/>",
+ " </s:states>",
+ "</s:Application>"
+ };
IMXMLStateNode node = getMXMLStateNode(code);
assertThat("getStateName", node.getStateName(), is("s1"));
String[] groups = node.getStateGroups();
Modified: flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLStringNodeTests.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLStringNodeTests.java?rev=1436586&r1=1436585&r2=1436586&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLStringNodeTests.java (original)
+++ flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLStringNodeTests.java Mon Jan 21 20:10:31 2013
@@ -35,7 +35,7 @@ import org.junit.Test;
*/
public class MXMLStringNodeTests extends MXMLExpressionNodeBaseTests
{
- private IMXMLStringNode getMXMLStringNode(String code)
+ private IMXMLStringNode getMXMLStringNode(String[] code)
{
IMXMLFileNode fileNode = getMXMLFileNode(code);
IMXMLStringNode node = (IMXMLStringNode)findFirstDescendantOfType(fileNode, IMXMLStringNode.class);
@@ -47,7 +47,10 @@ public class MXMLStringNodeTests extends
@Test
public void MXMLStringNode_empty1()
{
- String code = "<fx:String/>";
+ String[] code = new String[]
+ {
+ "<fx:String/>"
+ };
IMXMLStringNode node = getMXMLStringNode(code);
assertThat("getValue", node.getValue(), is("")); // was null in old compiler, but this is inconsistent with an empty String attribute
//assertThat("getExpressionNode", node.getExpressionNode(), is((IASNode)null));
@@ -56,7 +59,10 @@ public class MXMLStringNodeTests extends
@Test
public void MXMLStringNode_empty2()
{
- String code = "<fx:String></fx:String>";
+ String[] code = new String[]
+ {
+ "<fx:String></fx:String>"
+ };
IMXMLStringNode node = getMXMLStringNode(code);
assertThat("getValue", node.getValue(), is(""));
//assertThat("getExpressionNode", node.getExpressionNode(), is((IASNode)null));
@@ -65,7 +71,10 @@ public class MXMLStringNodeTests extends
@Test
public void MXMLStringNode_empty3()
{
- String code = "<fx:String> \t\r\n</fx:String>";
+ String[] code = new String[]
+ {
+ "<fx:String> \t\r\n</fx:String>"
+ };
IMXMLStringNode node = getMXMLStringNode(code);
assertThat("getValue", node.getValue(), is(""));
//assertThat("getExpressionNode", node.getExpressionNode(), is((IASNode)null));
@@ -74,7 +83,10 @@ public class MXMLStringNodeTests extends
@Test
public void MXMLStringNode_text()
{
- String code = "<fx:String>abc</fx:String>";
+ String[] code = new String[]
+ {
+ "<fx:String>abc</fx:String>"
+ };
IMXMLStringNode node = getMXMLStringNode(code);
assertThat("getValue", node.getValue(), is("abc"));
testExpressionLocation(node, 11, 14);
@@ -83,7 +95,10 @@ public class MXMLStringNodeTests extends
@Test
public void MXMLStringNode_text_with_whitespace()
{
- String code = "<fx:String> a b c </fx:String>";
+ String[] code = new String[]
+ {
+ "<fx:String> a b c </fx:String>"
+ };
IMXMLStringNode node = getMXMLStringNode(code);
assertThat("getValue", node.getValue(), is(" a b c "));
testExpressionLocation(node, 11, 18);
@@ -92,7 +107,10 @@ public class MXMLStringNodeTests extends
@Test
public void MXMLStringNode_numeric()
{
- String code = "<fx:String>123</fx:String>";
+ String[] code = new String[]
+ {
+ "<fx:String>123</fx:String>"
+ };
IMXMLStringNode node = getMXMLStringNode(code);
assertThat("getValue", node.getValue(), is("123"));
testExpressionLocation(node, 11, 14);
@@ -101,7 +119,10 @@ public class MXMLStringNodeTests extends
@Test
public void MXMLStringNode_true()
{
- String code = "<fx:String>true</fx:String>";
+ String[] code = new String[]
+ {
+ "<fx:String>true</fx:String>"
+ };
IMXMLStringNode node = getMXMLStringNode(code);
assertThat("getValue", node.getValue(), is("true"));
testExpressionLocation(node, 11, 15);
@@ -110,7 +131,10 @@ public class MXMLStringNodeTests extends
@Test
public void MXMLStringNode_entities()
{
- String code = "<fx:String>ABC</fx:String>";
+ String[] code = new String[]
+ {
+ "<fx:String>ABC</fx:String>"
+ };
IMXMLStringNode node = getMXMLStringNode(code);
assertThat("getValue", node.getValue(), is("ABC"));
testExpressionLocation(node, 11, 29);
@@ -120,7 +144,10 @@ public class MXMLStringNodeTests extends
@Test
public void MXMLStringNode_CDATA()
{
- String code = "<fx:String><![CDATA[a]]><![CDATA[b]]><![CDATA[c]]></fx:String>";
+ String[] code = new String[]
+ {
+ "<fx:String><![CDATA[a]]><![CDATA[b]]><![CDATA[c]]></fx:String>"
+ };
IMXMLStringNode node = getMXMLStringNode(code);
assertThat("getValue", node.getValue(), is("abc"));
testExpressionLocation(node, 11, 50);
@@ -129,7 +156,10 @@ public class MXMLStringNodeTests extends
@Test
public void MXMLStringNode_with_databinding()
{
- String code = "<fx:String>{a.b}</fx:String>";
+ String[] code = new String[]
+ {
+ "<fx:String>{a.b}</fx:String>"
+ };
IMXMLStringNode node = getMXMLStringNode(code);
assertThat("databinding node", node.getExpressionNode().getNodeID(), is(ASTNodeID.MXMLDataBindingID));
testExpressionLocation(node, 11, 16);
Modified: flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLStyleNodeTests.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLStyleNodeTests.java?rev=1436586&r1=1436585&r2=1436586&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLStyleNodeTests.java (original)
+++ flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLStyleNodeTests.java Mon Jan 21 20:10:31 2013
@@ -40,21 +40,7 @@ import com.google.common.collect.Immutab
*/
public class MXMLStyleNodeTests extends MXMLNodeBaseTests
{
- private static String PREFIX =
- "<d:Sprite xmlns:fx='http://ns.adobe.com/mxml/2009' xmlns:d='flash.display.*'>\n\t";
-
- private static String POSTFIX =
- "\n</d:Sprite>";
-
- private static String EOL = "\n\t";
-
- @Override
- protected IMXMLFileNode getMXMLFileNode(String code)
- {
- return super.getMXMLFileNode(PREFIX + code + POSTFIX);
- }
-
- private IMXMLStyleNode getMXMLStyleNode(String code)
+ private IMXMLStyleNode getMXMLStyleNode(String[] code)
{
IMXMLFileNode fileNode = getMXMLFileNode(code);
IMXMLStyleNode node = (IMXMLStyleNode)findFirstDescendantOfType(fileNode, IMXMLStyleNode.class);
@@ -66,7 +52,10 @@ public class MXMLStyleNodeTests extends
@Test
public void MXMLStyleNode_empty1()
{
- String code = "<fx:Style/>";
+ String[] code = new String[]
+ {
+ "<fx:Style/>"
+ };
IMXMLStyleNode node = getMXMLStyleNode(code);
assertThat("getChildCount", node.getChildCount(), is(0));
@@ -77,7 +66,10 @@ public class MXMLStyleNodeTests extends
@Test
public void MXMLStyleNode_empty2()
{
- String code = "<fx:Style></fx:Style>";
+ String[] code = new String[]
+ {
+ "<fx:Style></fx:Style>"
+ };
IMXMLStyleNode node = getMXMLStyleNode(code);
assertThat("getChildCount", node.getChildCount(), is(0));
@@ -88,7 +80,10 @@ public class MXMLStyleNodeTests extends
@Test
public void MXMLStyleNode_empty3()
{
- String code = "<fx:Style/> \t\r\n<fx:Style/>";
+ String[] code = new String[]
+ {
+ "<fx:Style/> \t\r\n<fx:Style/>"
+ };
IMXMLStyleNode node = getMXMLStyleNode(code);
assertThat("getChildCount", node.getChildCount(), is(0));
@@ -99,11 +94,13 @@ public class MXMLStyleNodeTests extends
@Test
public void MXMLStyleNode_two_rules()
{
- String code =
- "<fx:Style>" + EOL +
- " Button { font-size: 20; color: red }" + EOL +
- " CheckBox { font-size: 16 }" + EOL +
- "</fx:Style>";
+ String[] code = new String[]
+ {
+ "<fx:Style>",
+ " Button { font-size: 20; color: red }",
+ " CheckBox { font-size: 16 }",
+ "</fx:Style>"
+ };
IMXMLStyleNode node = getMXMLStyleNode(code);
assertThat("getChildCount", node.getChildCount(), is(0));
ICSSDocument css = node.getCSSDocument(null);
@@ -116,11 +113,13 @@ public class MXMLStyleNodeTests extends
@Test
public void MXMLStyleNode_two_same_namespaces()
{
- String code =
- "<fx:Style>" + EOL +
- " @namespace \"library://ns.adobe.com/flex/mx\";" + EOL +
- " @namespace \"library://ns.adobe.com/flex/mx\";" + EOL +
- "</fx:Style>";
+ String[] code = new String[]
+ {
+ "<fx:Style>",
+ " @namespace \"library://ns.adobe.com/flex/mx\";",
+ " @namespace \"library://ns.adobe.com/flex/mx\";",
+ "</fx:Style>"
+ };
IMXMLStyleNode node = getMXMLStyleNode(code);
assertThat("getChildCount", node.getChildCount(), is(0));
ICSSDocument css = node.getCSSDocument(null);
Modified: flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLUintNodeTests.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLUintNodeTests.java?rev=1436586&r1=1436585&r2=1436586&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLUintNodeTests.java (original)
+++ flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLUintNodeTests.java Mon Jan 21 20:10:31 2013
@@ -36,7 +36,7 @@ import org.junit.Test;
*/
public class MXMLUintNodeTests extends MXMLExpressionNodeBaseTests
{
- private IMXMLUintNode getMXMLUintNode(String code)
+ private IMXMLUintNode getMXMLUintNode(String[] code)
{
IMXMLFileNode fileNode = getMXMLFileNode(code);
IMXMLUintNode node = (IMXMLUintNode)findFirstDescendantOfType(fileNode, IMXMLUintNode.class);
@@ -48,7 +48,10 @@ public class MXMLUintNodeTests extends M
@Test
public void MXMLUintNode_empty1()
{
- String code = "<fx:uint/>";
+ String[] code = new String[]
+ {
+ "<fx:uint/>"
+ };
IMXMLUintNode node = getMXMLUintNode(code);
assertThat("getValue", node.getValue(), is(0L));
//assertThat("getExpressionNode", node.getExpressionNode(), is((IASNode)null));
@@ -57,7 +60,10 @@ public class MXMLUintNodeTests extends M
@Test
public void MXMLUintNode_empty2()
{
- String code = "<fx:uint></fx:uint>";
+ String[] code = new String[]
+ {
+ "<fx:uint></fx:uint>"
+ };
IMXMLUintNode node = getMXMLUintNode(code);
assertThat("getValue", node.getValue(), is(0L));
//assertThat("getExpressionNode", node.getExpressionNode(), is((IASNode)null));
@@ -66,7 +72,10 @@ public class MXMLUintNodeTests extends M
@Test
public void MXMLUintNode_empty3()
{
- String code = "<fx:uint> \t\r\n</fx:uint>";
+ String[] code = new String[]
+ {
+ "<fx:uint> \t\r\n</fx:uint>"
+ };
IMXMLUintNode node = getMXMLUintNode(code);
assertThat("getValue", node.getValue(), is(0L));
//assertThat("getExpressionNode", node.getExpressionNode(), is((IASNode)null));
@@ -75,7 +84,10 @@ public class MXMLUintNodeTests extends M
@Test
public void MXMLUintNode_zero()
{
- String code = "<fx:uint>0</fx:uint>";
+ String[] code = new String[]
+ {
+ "<fx:uint>0</fx:uint>"
+ };
IMXMLUintNode node = getMXMLUintNode(code);
assertThat("getValue", node.getValue(), is(0L));
testExpressionLocation(node, 9, 10);
@@ -84,7 +96,10 @@ public class MXMLUintNodeTests extends M
@Test
public void MXMLUintNode_one()
{
- String code = "<fx:uint>1</fx:uint>";
+ String[] code = new String[]
+ {
+ "<fx:uint>1</fx:uint>"
+ };
IMXMLUintNode node = getMXMLUintNode(code);
assertThat("getValue", node.getValue(), is(1L));
testExpressionLocation(node, 9, 10);
@@ -93,7 +108,10 @@ public class MXMLUintNodeTests extends M
@Test
public void MXMLUintNode_maxUint()
{
- String code = "<fx:uint>4294967295</fx:uint>";
+ String[] code = new String[]
+ {
+ "<fx:uint>4294967295</fx:uint>"
+ };
IMXMLUintNode node = getMXMLUintNode(code);
assertThat("getValue", node.getValue(), is(4294967295L));
testExpressionLocation(node, 9, 19);
@@ -102,7 +120,10 @@ public class MXMLUintNodeTests extends M
@Test
public void MXMLUintNode_hex_short_zero()
{
- String code = "<fx:uint>0x0</fx:uint>";
+ String[] code = new String[]
+ {
+ "<fx:uint>0x0</fx:uint>"
+ };
IMXMLUintNode node = getMXMLUintNode(code);
assertThat("getValue", node.getValue(), is(0L));
testExpressionLocation(node, 9, 12);
@@ -111,7 +132,10 @@ public class MXMLUintNodeTests extends M
@Test
public void MXMLUintNode_hex_max()
{
- String code = "<fx:uint>0x7FFFffff</fx:uint>";
+ String[] code = new String[]
+ {
+ "<fx:uint>0x7FFFffff</fx:uint>"
+ };
IMXMLUintNode node = getMXMLUintNode(code);
assertThat("getValue", node.getValue(), is(2147483647L));
testExpressionLocation(node, 9, 19);
@@ -120,7 +144,10 @@ public class MXMLUintNodeTests extends M
@Test
public void MXMLUintNode_hash_short_zero()
{
- String code = "<fx:uint>#0</fx:uint>";
+ String[] code = new String[]
+ {
+ "<fx:uint>#0</fx:uint>"
+ };
IMXMLUintNode node = getMXMLUintNode(code);
assertThat("getValue", node.getValue(), is(0L));
testExpressionLocation(node, 9, 11);
@@ -129,7 +156,10 @@ public class MXMLUintNodeTests extends M
@Test
public void MXMLUintNode_hash_max()
{
- String code = "<fx:uint>#7FFFFFFF</fx:uint>";
+ String[] code = new String[]
+ {
+ "<fx:uint>#7FFFFFFF</fx:uint>"
+ };
IMXMLUintNode node = getMXMLUintNode(code);
assertThat("getValue", node.getValue(), is(2147483647L));
testExpressionLocation(node, 9, 18);
@@ -138,7 +168,10 @@ public class MXMLUintNodeTests extends M
@Test
public void MXMLUintNode_withWhitespace()
{
- String code = "<fx:uint> 123 </fx:uint>";
+ String[] code = new String[]
+ {
+ "<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
@@ -148,7 +181,10 @@ public class MXMLUintNodeTests extends M
@Test
public void MXMLUintNode_nonnumeric()
{
- String code = "<fx:uint> abc </fx:uint>";
+ String[] code = new String[]
+ {
+ "<fx:uint> abc </fx:uint>"
+ };
IMXMLUintNode node = getMXMLUintNode(code);
assertThat("getValue", node.getValue(), is(0L));
assertThat("getExpressionNode", node.getExpressionNode(), is((IASNode)null));
@@ -157,7 +193,10 @@ public class MXMLUintNodeTests extends M
@Test
public void MXMLUintNode_with_databinding()
{
- String code = "<fx:uint>{a.b}</fx:uint>";
+ String[] code = new String[]
+ {
+ "<fx:uint>{a.b}</fx:uint>"
+ };
IMXMLUintNode node = getMXMLUintNode(code);
assertThat("databinding node", node.getExpressionNode().getNodeID(), is(ASTNodeID.MXMLDataBindingID));
testExpressionLocation(node, 9, 14);
Modified: flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLVectorNodeTests.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLVectorNodeTests.java?rev=1436586&r1=1436585&r2=1436586&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLVectorNodeTests.java (original)
+++ flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLVectorNodeTests.java Mon Jan 21 20:10:31 2013
@@ -39,9 +39,7 @@ import org.junit.Test;
*/
public class MXMLVectorNodeTests extends MXMLInstanceNodeTests
{
- private static String EOL = "\n\t\t";
-
- private IMXMLVectorNode getMXMLVectorNode(String code)
+ private IMXMLVectorNode getMXMLVectorNode(String[] code)
{
IMXMLFileNode fileNode = getMXMLFileNode(code);
IMXMLVectorNode node = (IMXMLVectorNode)findFirstDescendantOfType(fileNode, IMXMLVectorNode.class);
@@ -53,7 +51,10 @@ public class MXMLVectorNodeTests extends
@Test
public void MXMLVectorNode_empty1()
{
- String code = "<fx:Vector/>";
+ String[] code = new String[]
+ {
+ "<fx:Vector/>"
+ };
IMXMLVectorNode node = getMXMLVectorNode(code);
assertThat("getChildCount", node.getChildCount(), is(0));
}
@@ -61,7 +62,10 @@ public class MXMLVectorNodeTests extends
@Test
public void MXMLVectorNode_empty2()
{
- String code = "<fx:Vector></fx:Vector>";
+ String[] code = new String[]
+ {
+ "<fx:Vector></fx:Vector>"
+ };
IMXMLVectorNode node = getMXMLVectorNode(code);
assertThat("getChildCount", node.getChildCount(), is(0));
}
@@ -69,7 +73,10 @@ public class MXMLVectorNodeTests extends
@Test
public void MXMLVectorNode_empty3()
{
- String code = "<fx:Vector> \t\r\n</fx:Vector>";
+ String[] code = new String[]
+ {
+ "<fx:Vector> \t\r\n</fx:Vector>"
+ };
IMXMLVectorNode node = getMXMLVectorNode(code);
assertThat("getChildCount", node.getChildCount(), is(0));
}
@@ -77,12 +84,14 @@ public class MXMLVectorNodeTests extends
@Test
public void MXMLVectorNode_no_type()
{
- String code =
- "<fx:Vector>" + EOL +
- " <fx:Boolean>true</fx:Boolean>" + EOL +
- " <fx:int>123</fx:int>" + EOL +
- " <fx:String>abc</fx:String>" + EOL +
- "</fx:Vector>";
+ String[] code = new String[]
+ {
+ "<fx:Vector>",
+ " <fx:Boolean>true</fx:Boolean>",
+ " <fx:int>123</fx:int>",
+ " <fx:String>abc</fx:String>",
+ "</fx:Vector>"
+ };
IMXMLVectorNode node = getMXMLVectorNode(code);
assertThat("getType", node.getType(), is((ITypeDefinition)null));
assertThat("getFixed", node.getFixed(), is(false));
@@ -95,12 +104,14 @@ public class MXMLVectorNodeTests extends
@Test
public void MXMLVectorNode_Object_type()
{
- String code =
- "<fx:Vector type='Object'>" + EOL +
- " <fx:Boolean>true</fx:Boolean>" + EOL +
- " <fx:int>123</fx:int>" + EOL +
- " <fx:String>abc</fx:String>" + EOL +
- "</fx:Vector>";
+ String[] code = new String[]
+ {
+ "<fx:Vector type='Object'>",
+ " <fx:Boolean>true</fx:Boolean>",
+ " <fx:int>123</fx:int>",
+ " <fx:String>abc</fx:String>",
+ "</fx:Vector>"
+ };
IMXMLVectorNode node = getMXMLVectorNode(code);
assertThat("getType", node.getType().getQualifiedName(), is("Object"));
assertThat("getFixed", node.getFixed(), is(false));
@@ -113,12 +124,14 @@ public class MXMLVectorNodeTests extends
@Test
public void MXMLVectorNode_star_type()
{
- String code =
- "<fx:Vector type='*'>" + EOL +
- " <fx:Boolean>true</fx:Boolean>" + EOL +
- " <fx:int>123</fx:int>" + EOL +
- " <fx:String>abc</fx:String>" + EOL +
- "</fx:Vector>";
+ String[] code = new String[]
+ {
+ "<fx:Vector type='*'>",
+ " <fx:Boolean>true</fx:Boolean>",
+ " <fx:int>123</fx:int>",
+ " <fx:String>abc</fx:String>",
+ "</fx:Vector>"
+ };
IMXMLVectorNode node = getMXMLVectorNode(code);
assertThat("getType", node.getType().getQualifiedName(), is("*"));
assertThat("getFixed", node.getFixed(), is(false));
@@ -131,12 +144,14 @@ public class MXMLVectorNodeTests extends
@Test
public void MXMLVectorNode_int_type()
{
- String code =
- "<fx:Vector type='int'>" + EOL +
- " <fx:int>1</fx:int>" + EOL +
- " <fx:int>2</fx:int>" + EOL +
- " <fx:int>3</fx:int>" + EOL +
- "</fx:Vector>";
+ String[] code = new String[]
+ {
+ "<fx:Vector type='int'>",
+ " <fx:int>1</fx:int>",
+ " <fx:int>2</fx:int>",
+ " <fx:int>3</fx:int>",
+ "</fx:Vector>"
+ };
IMXMLVectorNode node = getMXMLVectorNode(code);
assertThat("getType", node.getType().getQualifiedName(), is("int"));
assertThat("getFixed", node.getFixed(), is(false));
@@ -149,17 +164,19 @@ public class MXMLVectorNodeTests extends
@Test
public void MXMLVectorNode_nested_int_vectors()
{
- String code =
- "<fx:Vector type='int'>" + EOL +
- " <fx:Vector type='int'>" + EOL +
- " <fx:int>1</fx:int>" + EOL +
- " <fx:int>2</fx:int>" + EOL +
- " </fx:Vector>" + EOL +
- " <fx:Vector type='int'>" + EOL +
- " <fx:int>3</fx:int>" + EOL +
- " <fx:int>4</fx:int>" + EOL +
- " </fx:Vector>" + EOL +
- "</fx:Vector>";
+ String[] code = new String[]
+ {
+ "<fx:Vector type='int'>",
+ " <fx:Vector type='int'>",
+ " <fx:int>1</fx:int>",
+ " <fx:int>2</fx:int>",
+ " </fx:Vector>",
+ " <fx:Vector type='int'>",
+ " <fx:int>3</fx:int>",
+ " <fx:int>4</fx:int>",
+ " </fx:Vector>",
+ "</fx:Vector>"
+ };
IMXMLVectorNode node = getMXMLVectorNode(code);
assertThat("getChildCount", node.getChildCount(), is(2));
assertThat("[0].getChildCount", ((IMXMLVectorNode)node.getChild(0)).getChildCount(), is(2));
@@ -174,7 +191,10 @@ public class MXMLVectorNodeTests extends
@Test
public void MXMLVectorNode_with_databinding()
{
- String code = "<fx:Vector>{a.b}</fx:Vector>";
+ String[] code = new String[]
+ {
+ "<fx:Vector>{a.b}</fx:Vector>"
+ };
IMXMLVectorNode node = getMXMLVectorNode(code);
assertThat("databinding node", node.getChild(0).getNodeID(), is(ASTNodeID.MXMLDataBindingID));
assertThat("databinding node child count", node.getChild(0).getChildCount(), is(1));
Modified: flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLWebServiceNodeTests.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLWebServiceNodeTests.java?rev=1436586&r1=1436585&r2=1436586&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLWebServiceNodeTests.java (original)
+++ flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLWebServiceNodeTests.java Mon Jan 21 20:10:31 2013
@@ -35,10 +35,8 @@ import org.junit.Test;
* @author Gordon Smith
*/
public class MXMLWebServiceNodeTests extends MXMLInstanceNodeTests
-{
- private static String EOL = "\n\t\t";
-
- private IMXMLWebServiceNode getMXMLWebServiceNode(String code)
+{
+ private IMXMLWebServiceNode getMXMLWebServiceNode(String[] code)
{
IMXMLFileNode fileNode = getMXMLFileNode(code);
IMXMLWebServiceNode node = (IMXMLWebServiceNode)findFirstDescendantOfType(fileNode, IMXMLWebServiceNode.class);
@@ -50,11 +48,13 @@ public class MXMLWebServiceNodeTests ext
@Test
public void MXMLWebServiceNode_twoOperations()
{
- String code =
- "<mx:WebService id='ws' wsdl='http://whatever'>" + EOL +
- " <mx:operation name='op1'/>" + EOL +
- " <mx:operation name='op2'/>" + EOL +
- "</mx:WebService>";
+ String[] code = new String[]
+ {
+ "<mx:WebService id='ws' wsdl='http://whatever'>",
+ " <mx:operation name='op1'/>",
+ " <mx:operation name='op2'/>",
+ "</mx:WebService>"
+ };
IMXMLWebServiceNode node = getMXMLWebServiceNode(code);
assertThat("getChildCount", node.getChildCount(), is(3));
IMXMLPropertySpecifierNode wsdlNode = (IMXMLPropertySpecifierNode)node.getChild(0);
Modified: flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLXMLListNodeTests.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLXMLListNodeTests.java?rev=1436586&r1=1436585&r2=1436586&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLXMLListNodeTests.java (original)
+++ flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLXMLListNodeTests.java Mon Jan 21 20:10:31 2013
@@ -35,9 +35,7 @@ import org.junit.Test;
*/
public class MXMLXMLListNodeTests extends MXMLInstanceNodeTests
{
- private static String EOL = "\n\t\t";
-
- private IMXMLXMLListNode getMXMLXMLListNode(String code)
+ private IMXMLXMLListNode getMXMLXMLListNode(String[] code)
{
IMXMLFileNode fileNode = getMXMLFileNode(code);
IMXMLXMLListNode node = (IMXMLXMLListNode)findFirstDescendantOfType(fileNode, IMXMLXMLListNode.class);
@@ -49,7 +47,10 @@ public class MXMLXMLListNodeTests extend
@Test
public void MXMLXMLListNode_empty1()
{
- String code = "<fx:XMLList/>";
+ String[] code = new String[]
+ {
+ "<fx:XMLList/>"
+ };
IMXMLXMLListNode node = getMXMLXMLListNode(code);
assertThat("getChildCount", node.getChildCount(), is(0));
}
@@ -57,7 +58,10 @@ public class MXMLXMLListNodeTests extend
@Test
public void MXMLXMLListNode_empty2()
{
- String code = "<fx:XMLList></fx:XMLList>";
+ String[] code = new String[]
+ {
+ "<fx:XMLList></fx:XMLList>"
+ };
IMXMLXMLListNode node = getMXMLXMLListNode(code);
assertThat("getChildCount", node.getChildCount(), is(0));
}
@@ -65,7 +69,10 @@ public class MXMLXMLListNodeTests extend
@Test
public void MXMLXMLListNode_empty3()
{
- String code = "<fx:XMLList> \t\r\n</fx:XMLList>";
+ String[] code = new String[]
+ {
+ "<fx:XMLList> \t\r\n</fx:XMLList>"
+ };
IMXMLXMLListNode node = getMXMLXMLListNode(code);
assertThat("getChildCount", node.getChildCount(), is(0));
}
@@ -73,11 +80,13 @@ public class MXMLXMLListNodeTests extend
@Test
public void MXMLXMLListNode_two_empty_tags()
{
- String code =
- "<fx:XMLList>" + EOL +
- " <a/>" + EOL +
- " <b/>" + EOL +
- "</fx:XMLList>";
+ String[] code = new String[]
+ {
+ "<fx:XMLList>",
+ " <a/>",
+ " <b/>",
+ "</fx:XMLList>"
+ };
IMXMLXMLListNode node = getMXMLXMLListNode(code);
assertThat("getChildCount", node.getChildCount(), is(0));
assertThat("getXMLString", node.getXMLString(), is("<a/><b/>"));
@@ -87,7 +96,10 @@ public class MXMLXMLListNodeTests extend
@Test
public void MXMLXMListLNode_with_databinding()
{
- String code = "<fx:XMLList>{a.b}</fx:XMLList>";
+ String[] code = new String[]
+ {
+ "<fx:XMLList>{a.b}</fx:XMLList>"
+ };
IMXMLXMLListNode node = getMXMLXMLListNode(code);
assertThat("databinding node", node.getChild(0).getNodeID(), is(ASTNodeID.MXMLDataBindingID));
assertThat("databinding node child count", node.getChild(0).getChildCount(), is(1));
Modified: flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLXMLNodeTests.java
URL: http://svn.apache.org/viewvc/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLXMLNodeTests.java?rev=1436586&r1=1436585&r2=1436586&view=diff
==============================================================================
--- flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLXMLNodeTests.java (original)
+++ flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLXMLNodeTests.java Mon Jan 21 20:10:31 2013
@@ -34,10 +34,8 @@ import org.junit.Test;
* @author Gordon Smith
*/
public class MXMLXMLNodeTests extends MXMLInstanceNodeTests
-{
- private static String EOL = "\n\t\t";
-
- private IMXMLXMLNode getMXMLXMLNode(String code)
+{
+ private IMXMLXMLNode getMXMLXMLNode(String[] code)
{
IMXMLFileNode fileNode = getMXMLFileNode(code);
IMXMLXMLNode node = (IMXMLXMLNode)findFirstDescendantOfType(fileNode, IMXMLXMLNode.class);
@@ -49,7 +47,10 @@ public class MXMLXMLNodeTests extends MX
@Test
public void MXMLXMLNode_empty1()
{
- String code = "<fx:XML/>";
+ String[] code = new String[]
+ {
+ "<fx:XML/>"
+ };
IMXMLXMLNode node = getMXMLXMLNode(code);
assertThat("getXMLType", node.getXMLType(), is(IMXMLXMLNode.XML_TYPE.E4X));
assertThat("getChildCount", node.getChildCount(), is(0));
@@ -59,7 +60,10 @@ public class MXMLXMLNodeTests extends MX
@Test
public void MXMLXMLNode_empty2()
{
- String code = "<fx:XML></fx:XML>";
+ String[] code = new String[]
+ {
+ "<fx:XML></fx:XML>"
+ };
IMXMLXMLNode node = getMXMLXMLNode(code);
assertThat("getXMLType", node.getXMLType(), is(IMXMLXMLNode.XML_TYPE.E4X));
assertThat("getChildCount", node.getChildCount(), is(0));
@@ -69,7 +73,10 @@ public class MXMLXMLNodeTests extends MX
@Test
public void MXMLXMLNode_empty3()
{
- String code = "<fx:XML> \t\r\n</fx:XML>";
+ String[] code = new String[]
+ {
+ "<fx:XML> \t\r\n</fx:XML>"
+ };
IMXMLXMLNode node = getMXMLXMLNode(code);
assertThat("getXMLType", node.getXMLType(), is(IMXMLXMLNode.XML_TYPE.E4X));
assertThat("getChildCount", node.getChildCount(), is(0));
@@ -79,10 +86,12 @@ public class MXMLXMLNodeTests extends MX
@Test
public void MXMLXMLNode_empty_root()
{
- String code =
- "<fx:XML>" + EOL +
- " <root/>" + EOL +
- "</fx:XML>";
+ String[] code = new String[]
+ {
+ "<fx:XML>",
+ " <root/>",
+ "</fx:XML>"
+ };
IMXMLXMLNode node = getMXMLXMLNode(code);
assertThat("getXMLType", node.getXMLType(), is(IMXMLXMLNode.XML_TYPE.E4X));
assertThat("getChildCount", node.getChildCount(), is(0));
@@ -92,12 +101,14 @@ public class MXMLXMLNodeTests extends MX
@Test
public void MXMLXMLNode_root_with_one_child_with_text()
{
- String code =
- "<fx:XML>" + EOL +
- " <root>" + EOL +
- " <a>xxx</a>" + EOL +
- " </root>" + EOL +
- "</fx:XML>";
+ String[] code = new String[]
+ {
+ "<fx:XML>",
+ " <root>",
+ " <a>xxx</a>",
+ " </root>",
+ "</fx:XML>"
+ };
IMXMLXMLNode node = getMXMLXMLNode(code);
assertThat("getXMLType", node.getXMLType(), is(IMXMLXMLNode.XML_TYPE.E4X));
assertThat("getChildCount", node.getChildCount(), is(0));
@@ -107,12 +118,14 @@ public class MXMLXMLNodeTests extends MX
@Test
public void MXMLXMLNode_root_with_one_child_with_attribute()
{
- String code =
- "<fx:XML>" + EOL +
- " <root>" + EOL +
- " <a b='xxx'>" + EOL +
- " </root>" + EOL +
- "</fx:XML>";
+ String[] code = new String[]
+ {
+ "<fx:XML>",
+ " <root>",
+ " <a b='xxx'>",
+ " </root>",
+ "</fx:XML>"
+ };
IMXMLXMLNode node = getMXMLXMLNode(code);
assertThat("getXMLType", node.getXMLType(), is(IMXMLXMLNode.XML_TYPE.E4X));
assertThat("getChildCount", node.getChildCount(), is(0));
@@ -123,7 +136,10 @@ public class MXMLXMLNodeTests extends MX
@Test
public void MXMLXMLNode_with_databinding()
{
- String code = "<fx:XML>{a.b}</fx:XML>";
+ String[] code = new String[]
+ {
+ "<fx:XML>{a.b}</fx:XML>"
+ };
IMXMLXMLNode node = getMXMLXMLNode(code);
assertThat("databinding node", node.getChild(0).getNodeID(), is(ASTNodeID.MXMLDataBindingID));
assertThat("databinding node child count", node.getChild(0).getChildCount(), is(1));