flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gordonsm...@apache.org
Subject svn commit: r1415883 - in /incubator/flex/falcon/trunk: compiler.tests/ compiler.tests/feature-tests/ compiler.tests/feature-tests/mxml/ compiler.tests/feature-tests/mxml/tags/ compiler/src/org/apache/flex/utils/
Date Fri, 30 Nov 2012 23:09:53 GMT
Author: gordonsmith
Date: Fri Nov 30 23:09:49 2012
New Revision: 1415883

URL: http://svn.apache.org/viewvc?rev=1415883&view=rev
Log:
Falcon: Added simple MXML feature tests for <Boolean>, <int>, <uint>, <Number>,
<String>, <Class> and generic instance tags such as <Sprite>. They are not
yet part of 'ant tsets'.

These tests currently create an MXML file, compile it to a SWF with MXMLC, and check that
it compiles cleanly. Soon I'll make the SWF run in Flash Player and check that the runtime
asserts don't fire, so that we know that codegen is correct.

Such "feature tests" are intended to test one specific feature of MXML all the way through
compilation and execution. By contrast, "unit tests" test only a particular class or subsystem,
such as testing the MXML lexer to create MXML tokens, or testing how the MXML parser creates
particular kinds of MXML nodes. Furthermore, "functional tests" test real-world situations
involving multiple features working together. There are three distinct directories for these
various kinds of Falcon tests.

Feature tests do not need to be as exhaustive as the unit tests. For example, suppose we have
a complete set of parser tests for the <int> tag and know that ultimately an MXMLLiteralNode
gets created with an appropriate int value in each case. Then we do not need to have feature
tests for things like integer tags with whitspace around the integer text, or hex integer
text, or empty int tags, etc. We can just do a few feature tests that make sure that MXMLLiteralNodes
with int values codegen integer values in the VM.

Added:
    incubator/flex/falcon/trunk/compiler.tests/feature-tests/
    incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/
    incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/
    incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLBooleanTagTests.java
  (with props)
    incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLClassTagTests.java
  (with props)
    incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLFeatureTestsBase.java
  (with props)
    incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLInstanceTagTests.java
  (with props)
    incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLInstanceTagTestsBase.java
  (with props)
    incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLIntTagTests.java
  (with props)
    incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLNumberTagTests.java
  (with props)
    incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLStringTagTests.java
  (with props)
    incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLUintTagTests.java
  (with props)
Modified:
    incubator/flex/falcon/trunk/compiler.tests/.classpath
    incubator/flex/falcon/trunk/compiler/src/org/apache/flex/utils/StringUtils.java

Modified: incubator/flex/falcon/trunk/compiler.tests/.classpath
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/.classpath?rev=1415883&r1=1415882&r2=1415883&view=diff
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/.classpath (original)
+++ incubator/flex/falcon/trunk/compiler.tests/.classpath Fri Nov 30 23:09:49 2012
@@ -2,6 +2,7 @@
 <classpath>
 	<classpathentry excluding="**/.svn/*" kind="src" path="unit-tests"/>
 	<classpathentry excluding="**/.svn/*" kind="src" path="functional-tests"/>
+	<classpathentry kind="src" path="feature-tests"/>
 	<classpathentry kind="lib" path="lib/junit-4.10.jar"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 	<classpathentry kind="lib" path="/compiler/lib/commons-io.jar"/>

Added: incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLBooleanTagTests.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLBooleanTagTests.java?rev=1415883&view=auto
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLBooleanTagTests.java
(added)
+++ incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLBooleanTagTests.java
Fri Nov 30 23:09:49 2012
@@ -0,0 +1,47 @@
+/*
+ *
+ *  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 mxml.tags;
+
+import org.junit.Test;
+
+/**
+ * Feature tests for the MXML <Boolean> tag.
+ * 
+ * @author Gordon Smith
+ */
+public class MXMLBooleanTagTests extends MXMLInstanceTagTestsBase
+{
+    @Test
+    public void MXMLBooleanTag_basic()
+    {
+        String[] declarations = new String[]
+        {
+            "<fx:Boolean id='b1'>false</fx:Boolean>",
+            "<fx:Boolean id='b2'>true</fx:Boolean>"
+        };
+        String[] asserts = new String[]
+        {
+            "assertEqual('b1', b1, false);",
+            "assertEqual('b2', b2, true);"
+        };
+        String mxml = getMXML(declarations, asserts);
+        compileAndRun(mxml);
+    }
+}

Propchange: incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLBooleanTagTests.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLClassTagTests.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLClassTagTests.java?rev=1415883&view=auto
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLClassTagTests.java
(added)
+++ incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLClassTagTests.java
Fri Nov 30 23:09:49 2012
@@ -0,0 +1,45 @@
+/*
+ *
+ *  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 mxml.tags;
+
+import org.junit.Test;
+
+/**
+ * Feature tests for the MXML <Class> tag.
+ * 
+ * @author Gordon Smith
+ */
+public class MXMLClassTagTests extends MXMLInstanceTagTestsBase
+{
+    @Test
+    public void MXMLNumberTag_basic()
+    {
+        String[] declarations = new String[]
+        {
+            "<fx:Class id='c1'>flash.display.Sprite</fx:Class>"
+        };
+        String[] asserts = new String[]
+        {
+            "assertEqual('c1', c1 is Sprite, true);",
+        };
+        String mxml = getMXML(declarations, asserts);
+        compileAndRun(mxml);
+    }
+}

Propchange: incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLClassTagTests.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLFeatureTestsBase.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLFeatureTestsBase.java?rev=1415883&view=auto
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLFeatureTestsBase.java
(added)
+++ incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLFeatureTestsBase.java
Fri Nov 30 23:09:49 2012
@@ -0,0 +1,79 @@
+/*
+ *
+ *  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 mxml.tags;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+
+import org.apache.flex.compiler.clients.MXMLC;
+import org.apache.flex.utils.FilenameNormalization;
+
+/**
+ * Base class for MXML feature tests which compile MXML code with MXMLC and run it in the
standalone Flash Player.
+ * 
+ * @author Gordon Smith
+ */
+public class MXMLFeatureTestsBase
+{
+	private static final String SDK = FilenameNormalization.normalize("../compiler/generated/dist/sdk");
+	private static final String PLAYERGLOBAL_SWC = FilenameNormalization.normalize(SDK + "\\frameworks\\libs\\player\\11.1\\playerglobal.swc");
+	private static final String NAMESPACE_2009 = "http://ns.adobe.com/mxml/2009";
+    private static final String MANIFEST_2009 = FilenameNormalization.normalize(SDK + "\\frameworks\\mxml-2009-manifest.xml");
+
+	protected void compileAndRun(String mxml)
+	{
+		// Write the MXML into a temp file.
+		String tempDir = FilenameNormalization.normalize("temp");
+		File tempMXMLFile = null;
+		try
+		{
+			tempMXMLFile = File.createTempFile(getClass().getSimpleName(), ".mxml", new File(tempDir));
+			tempMXMLFile.deleteOnExit();
+
+			BufferedWriter out = new BufferedWriter(new FileWriter(tempMXMLFile));
+		    out.write(mxml);
+		    out.close();
+		}
+		catch (IOException e1) 
+		{
+			e1.printStackTrace();
+		}
+		
+		// Use MXMLC to compile the MXML file against playerglobal.swc.
+		MXMLC mxmlc = new MXMLC();
+		String[] args = new String[]
+        {
+			"-external-library-path=" + PLAYERGLOBAL_SWC,
+			"-namespace=" + NAMESPACE_2009 + "," + MANIFEST_2009,
+			tempMXMLFile.getAbsolutePath()
+		};
+		int exitCode = mxmlc.mainNoExit(args);
+		
+		// Check that there were no compilation problems.
+		assertThat(exitCode, is(0));
+		
+		// Coming soon-- run the SWF in the standalone player and check that there are no runtime
asserts.
+	}
+}

Propchange: incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLFeatureTestsBase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLInstanceTagTests.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLInstanceTagTests.java?rev=1415883&view=auto
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLInstanceTagTests.java
(added)
+++ incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLInstanceTagTests.java
Fri Nov 30 23:09:49 2012
@@ -0,0 +1,45 @@
+/*
+ *
+ *  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 mxml.tags;
+
+import org.junit.Test;
+
+/**
+ * Base class for feature tests for MXML instance tags.
+ * 
+ * @author Gordon Smith
+ */
+public class MXMLInstanceTagTests extends MXMLInstanceTagTestsBase
+{
+    @Test
+    public void MXMLInstanceTag_basic()
+    {
+        String[] declarations = new String[]
+        {
+            "<d:Sprite id='b'/>"
+        };
+        String[] asserts = new String[]
+        {
+	        "assertEqual('b', b is Sprite, true);"	
+        };
+        String mxml = getMXML(declarations, asserts);
+        compileAndRun(mxml);
+    }
+}

Propchange: incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLInstanceTagTests.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLInstanceTagTestsBase.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLInstanceTagTestsBase.java?rev=1415883&view=auto
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLInstanceTagTestsBase.java
(added)
+++ incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLInstanceTagTestsBase.java
Fri Nov 30 23:09:49 2012
@@ -0,0 +1,63 @@
+/*
+ *
+ *  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 mxml.tags;
+
+import org.apache.flex.utils.StringUtils;
+
+/**
+ * Base class for feature tests for MXML instance tags.
+ * 
+ * @author Gordon Smith
+ */
+public class MXMLInstanceTagTestsBase extends MXMLFeatureTestsBase
+{
+	/**
+	 * Combines various code snippets to make a complete one-file MXML Sprite-based application.
+	 */
+    protected String getMXML(String[] declarations, String[] asserts)
+    {
+        String[] template = new String[]
+        {
+            "<d:Sprite xmlns:fx='http://ns.adobe.com/mxml/2009' xmlns:d='flash.display.*'",
+            "          enterFrame='enterFrameHandler(event)'>",
+            "    <fx:Declarations>",
+            "        %1",
+            "    </fx:Declarations>",
+            "    <fx:Script>",
+            "    <![CDATA[",
+            "        private function assertEqual(message:String, actualValue:*, expectedValue:*):void",
+            "        {",
+            "            if (actualValue !== expectedValue)",
+            "                trace(message, actualValue, expectedValue);",
+            "        }",
+            "        private function enterFrameHandler(event:Event):void",
+            "        {",
+            "            %2",
+            "        }",
+            "    ]]>",
+            "    </fx:Script>",
+            "</d:Sprite>"
+        };
+        String mxml = StringUtils.join(template, "\n");
+        mxml = mxml.replace("%1", StringUtils.join(declarations, "\n        "));
+        mxml = mxml.replace("%2", StringUtils.join(asserts, "\n            "));
+        return mxml;
+    }
+}

Propchange: incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLInstanceTagTestsBase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLIntTagTests.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLIntTagTests.java?rev=1415883&view=auto
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLIntTagTests.java
(added)
+++ incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLIntTagTests.java
Fri Nov 30 23:09:49 2012
@@ -0,0 +1,49 @@
+/*
+ *
+ *  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 mxml.tags;
+
+import org.junit.Test;
+
+/**
+ * Feature tests for the MXML <int> tag.
+ * 
+ * @author Gordon Smith
+ */
+public class MXMLIntTagTests extends MXMLInstanceTagTestsBase
+{
+    @Test
+    public void MXMLIntTag_basic()
+    {
+        String[] declarations = new String[]
+        {
+            "<fx:int id='i1'>0</fx:int>",
+            "<fx:int id='i2'>2147483647</fx:int>",
+            "<fx:int id='i3'>-2147483648</fx:int>"
+        };
+        String[] asserts = new String[]
+        {
+            "assertEqual('i1', i1, 0);",
+            "assertEqual('i2', i2, 2147483647);",
+            "assertEqual('i3', i3, -2147483648);"
+        };
+        String mxml = getMXML(declarations, asserts);
+        compileAndRun(mxml);
+    }
+}

Propchange: incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLIntTagTests.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLNumberTagTests.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLNumberTagTests.java?rev=1415883&view=auto
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLNumberTagTests.java
(added)
+++ incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLNumberTagTests.java
Fri Nov 30 23:09:49 2012
@@ -0,0 +1,45 @@
+/*
+ *
+ *  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 mxml.tags;
+
+import org.junit.Test;
+
+/**
+ * Feature tests for the MXML <Number> tag.
+ * 
+ * @author Gordon Smith
+ */
+public class MXMLNumberTagTests extends MXMLInstanceTagTestsBase
+{
+    @Test
+    public void MXMLNumberTag_basic()
+    {
+        String[] declarations = new String[]
+        {
+            "<fx:Number id='n1'>1.5</fx:Number>"
+        };
+        String[] asserts = new String[]
+        {
+            "assertEqual('n1', n1, 1.5);",
+        };
+        String mxml = getMXML(declarations, asserts);
+        compileAndRun(mxml);
+    }
+}

Propchange: incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLNumberTagTests.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLStringTagTests.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLStringTagTests.java?rev=1415883&view=auto
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLStringTagTests.java
(added)
+++ incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLStringTagTests.java
Fri Nov 30 23:09:49 2012
@@ -0,0 +1,45 @@
+/*
+ *
+ *  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 mxml.tags;
+
+import org.junit.Test;
+
+/**
+ * Feature tests for the MXML <String> tag.
+ * 
+ * @author Gordon Smith
+ */
+public class MXMLStringTagTests extends MXMLInstanceTagTestsBase
+{
+    @Test
+    public void MXMLStringTag_basic()
+    {
+        String[] declarations = new String[]
+        {
+            "<fx:String id='s1'>abc</fx:String>"
+        };
+        String[] asserts = new String[]
+        {
+            "assertEqual('s1', s1, 'abc');",
+        };
+        String mxml = getMXML(declarations, asserts);
+        compileAndRun(mxml);
+    }
+}

Propchange: incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLStringTagTests.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLUintTagTests.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLUintTagTests.java?rev=1415883&view=auto
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLUintTagTests.java
(added)
+++ incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLUintTagTests.java
Fri Nov 30 23:09:49 2012
@@ -0,0 +1,47 @@
+/*
+ *
+ *  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 mxml.tags;
+
+import org.junit.Test;
+
+/**
+ * Feature tests for the MXML <uint> tag.
+ * 
+ * @author Gordon Smith
+ */
+public class MXMLUintTagTests extends MXMLInstanceTagTestsBase
+{
+    @Test
+    public void MXMLUintTag_basic()
+    {
+        String[] declarations = new String[]
+        {
+            "<fx:uint id='u1'>0</fx:uint>",
+            "<fx:uint id='u2'>4294967295</fx:uint>",
+        };
+        String[] asserts = new String[]
+        {
+            "assertEqual('u1', u1, 0);",
+            "assertEqual('u2', u2, 4294967295);",
+        };
+        String mxml = getMXML(declarations, asserts);
+        compileAndRun(mxml);
+    }
+}

Propchange: incubator/flex/falcon/trunk/compiler.tests/feature-tests/mxml/tags/MXMLUintTagTests.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/flex/falcon/trunk/compiler/src/org/apache/flex/utils/StringUtils.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler/src/org/apache/flex/utils/StringUtils.java?rev=1415883&r1=1415882&r2=1415883&view=diff
==============================================================================
--- incubator/flex/falcon/trunk/compiler/src/org/apache/flex/utils/StringUtils.java (original)
+++ incubator/flex/falcon/trunk/compiler/src/org/apache/flex/utils/StringUtils.java Fri Nov
30 23:09:49 2012
@@ -87,4 +87,19 @@ public class StringUtils
 		result.append('"');
 		return result.toString();
 	}
+	
+	public static String join(String[] a, String c)
+	{
+	    StringBuilder sb = new StringBuilder();
+	    
+	    int n = a.length;
+	    for (int i = 0; i < n; i++)
+	    {
+	        sb.append(a[i]);
+	        if (i < n - 1)
+	            sb.append(c);
+	    }
+	    
+	    return sb.toString();
+	}
 }



Mime
View raw message