Return-Path: X-Original-To: apmail-incubator-flex-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-flex-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1EBC7DD5F for ; Fri, 30 Nov 2012 23:10:16 +0000 (UTC) Received: (qmail 17731 invoked by uid 500); 30 Nov 2012 23:10:15 -0000 Delivered-To: apmail-incubator-flex-commits-archive@incubator.apache.org Received: (qmail 17684 invoked by uid 500); 30 Nov 2012 23:10:15 -0000 Mailing-List: contact flex-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: flex-dev@incubator.apache.org Delivered-To: mailing list flex-commits@incubator.apache.org Received: (qmail 17676 invoked by uid 99); 30 Nov 2012 23:10:15 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 Nov 2012 23:10:15 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 Nov 2012 23:10:13 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id D5482238897F; Fri, 30 Nov 2012 23:09:53 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: flex-commits@incubator.apache.org From: gordonsmith@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20121130230953.D5482238897F@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 , , , , , and generic instance tags such as . 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 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 @@ + 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 tag. + * + * @author Gordon Smith + */ +public class MXMLBooleanTagTests extends MXMLInstanceTagTestsBase +{ + @Test + public void MXMLBooleanTag_basic() + { + String[] declarations = new String[] + { + "false", + "true" + }; + 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 tag. + * + * @author Gordon Smith + */ +public class MXMLClassTagTests extends MXMLInstanceTagTestsBase +{ + @Test + public void MXMLNumberTag_basic() + { + String[] declarations = new String[] + { + "flash.display.Sprite" + }; + 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[] + { + "" + }; + 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[] + { + "", + " ", + " %1", + " ", + " ", + " ", + " ", + "" + }; + 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 tag. + * + * @author Gordon Smith + */ +public class MXMLIntTagTests extends MXMLInstanceTagTestsBase +{ + @Test + public void MXMLIntTag_basic() + { + String[] declarations = new String[] + { + "0", + "2147483647", + "-2147483648" + }; + 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 tag. + * + * @author Gordon Smith + */ +public class MXMLNumberTagTests extends MXMLInstanceTagTestsBase +{ + @Test + public void MXMLNumberTag_basic() + { + String[] declarations = new String[] + { + "1.5" + }; + 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 tag. + * + * @author Gordon Smith + */ +public class MXMLStringTagTests extends MXMLInstanceTagTestsBase +{ + @Test + public void MXMLStringTag_basic() + { + String[] declarations = new String[] + { + "abc" + }; + 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 tag. + * + * @author Gordon Smith + */ +public class MXMLUintTagTests extends MXMLInstanceTagTestsBase +{ + @Test + public void MXMLUintTag_basic() + { + String[] declarations = new String[] + { + "0", + "4294967295", + }; + 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(); + } }