http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/523eac21/manualtests/UnitTests/src/main/flex/flexUnitTests/core/StrandTesterTest.as ---------------------------------------------------------------------- diff --git a/manualtests/UnitTests/src/main/flex/flexUnitTests/core/StrandTesterTest.as b/manualtests/UnitTests/src/main/flex/flexUnitTests/core/StrandTesterTest.as new file mode 100644 index 0000000..f6715bb --- /dev/null +++ b/manualtests/UnitTests/src/main/flex/flexUnitTests/core/StrandTesterTest.as @@ -0,0 +1,55 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 flexUnitTests.core +{ + import flexunit.framework.Assert; + + import org.apache.flex.core.Strand; + + public class StrandTesterTest + { + [Before] + public function setUp():void + { + } + + [After] + public function tearDown():void + { + } + + [BeforeClass] + public static function setUpBeforeClass():void + { + } + + [AfterClass] + public static function tearDownAfterClass():void + { + } + + [Test] + public function testIdProperty():void + { + var strand:Strand = new Strand(); + strand.id = "foo"; + Assert.assertEquals("Error testing Srand.id", "foo",strand.id); + } + } +}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/523eac21/manualtests/UnitTests/src/main/flex/flexUnitTests/jira/JiraTesterTest.as ---------------------------------------------------------------------- diff --git a/manualtests/UnitTests/src/main/flex/flexUnitTests/jira/JiraTesterTest.as b/manualtests/UnitTests/src/main/flex/flexUnitTests/jira/JiraTesterTest.as new file mode 100644 index 0000000..c361f39 --- /dev/null +++ b/manualtests/UnitTests/src/main/flex/flexUnitTests/jira/JiraTesterTest.as @@ -0,0 +1,73 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 flexUnitTests.jira +{ + import flexunit.framework.Assert; + + + public class JiraTesterTest + { + public static var isJS:Boolean; + [BeforeClass] + public static function setUpBeforeClass():void + { + var js:Boolean = false; + try { + var check:* = getDefinitionByName("flash.system.Capabilities"); + } catch (e:Error) { + js = true; + } + //if this next reference to 'check' is not included, then the above try/catch code + // appears to be optimized away in js-release mode + //todo: this is inconsistent with swf, need to create simple test case for jx compiler/gcc + if (check == null) { + js = true; + } + isJS = js; + } + + [AfterClass] + public static function tearDownAfterClass():void + { + } + + + [Before] + public function setUp():void + { + } + + [After] + public function tearDown():void + { + } + + + /* + // TEST METHODS + */ + + //example, postfix the test method with JIRA issue reference: + /*[Test] + public function testJIRA_FLEX_9999():void + { + + }*/ + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/523eac21/manualtests/UnitTests/src/main/flex/flexUnitTests/observedbugs/ObservedBugTests.as ---------------------------------------------------------------------- diff --git a/manualtests/UnitTests/src/main/flex/flexUnitTests/observedbugs/ObservedBugTests.as b/manualtests/UnitTests/src/main/flex/flexUnitTests/observedbugs/ObservedBugTests.as new file mode 100644 index 0000000..ab84f15 --- /dev/null +++ b/manualtests/UnitTests/src/main/flex/flexUnitTests/observedbugs/ObservedBugTests.as @@ -0,0 +1,91 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 flexUnitTests.observedbugs +{ + import flexunit.framework.Assert; + import org.apache.flex.reflection.*; + + public class ObservedBugTests + { + + public static var isJS:Boolean; + [BeforeClass] + public static function setUpBeforeClass():void + { + var js:Boolean = false; + try { + var check:* = getDefinitionByName("flash.system.Capabilities"); + } catch (e:Error) { + js = true; + } + //this was originally necessary to avoid a gcc-related bug in js for release mode only + if (check == null) { + js = true; + } + isJS = js; + } + + [AfterClass] + public static function tearDownAfterClass():void + { + } + + [Before] + public function setUp():void + { + } + + [After] + public function tearDown():void + { + } + + + [Test] + public function testTryCatchJSReleaseModeWorks_a():void + { + var js:int = 1; + try { + js = getDefinitionByName("flash.system.Capabilities") != null ? 1 : 0; + } catch (e:Error) { + js = 2; + } + + Assert.assertTrue("Unexpected value following try/catch",(isJS ? (js == 2) : (js == 1))); + + } + + //This Observed bug is no longer present 0.9.0 + //it may be related to a Google Closure Compiler update since it was originally observed + //leaving the tests in here for now... + //[TestVariance(variance="JS",description="Variance in test, this test fails in JS-Release mode only")] + [Test] + public function testTryCatchJSReleaseModeFails_b():void + { + var js:Boolean = false; + try { + var check:* = getDefinitionByName("flash.system.Capabilities"); + } catch (e:Error) { + js = true; + } + + Assert.assertTrue("Unexpected value following try/catch",(isJS ? (js === true) : (js === false))); + } + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/523eac21/manualtests/UnitTests/src/main/flex/flexUnitTests/reflection/ReflectionTesterTest.as ---------------------------------------------------------------------- diff --git a/manualtests/UnitTests/src/main/flex/flexUnitTests/reflection/ReflectionTesterTest.as b/manualtests/UnitTests/src/main/flex/flexUnitTests/reflection/ReflectionTesterTest.as new file mode 100644 index 0000000..9d39fc9 --- /dev/null +++ b/manualtests/UnitTests/src/main/flex/flexUnitTests/reflection/ReflectionTesterTest.as @@ -0,0 +1,373 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 flexUnitTests.reflection +{ + import flexunit.framework.Assert; + import flexUnitTests.reflection.support.*; + import org.apache.flex.reflection.*; + + public class ReflectionTesterTest + { + + public static var isJS:Boolean; + [BeforeClass] + public static function setUpBeforeClass():void + { + var js:Boolean = false; + try { + var check:* = getDefinitionByName("flash.system.Capabilities"); + } catch (e:Error) { + js = true; + } + //if this next reference to 'check' is not included, then the above try/catch code + //appears to be optimized away in js-release mode + //a separate test has been created for this + if (check == null) { + js = true; + } + isJS = js; + } + + [AfterClass] + public static function tearDownAfterClass():void + { + } + + [Before] + public function setUp():void + { + TestClass2.testStaticVar = "testStaticVar_val"; + TestClass2.testStaticWriteOnly = "staticAccessor_initial_value"; + } + + [After] + public function tearDown():void + { + } + + private static function retrieveItemWithName(collection:Array, name:String):DefinitionBase { + var ret:DefinitionBase; + var i:uint=0,l:uint=collection.length; + for (;i<l;i++) { + if (collection[i].name==name) { + ret = collection[i]; + break; + } + } + + return ret; + } + + + [Test] + public function testBasicDescribeTypeClass():void + { + var def:TypeDefinition = describeType(TestClass2); + + Assert.assertEquals("Unexpected package name",def.packageName,"flexUnitTests.reflection.support"); + Assert.assertEquals("Unexpected type name",def.name,"TestClass2"); + + var variables:Array = def.variables; + Assert.assertEquals("unexpected variables length",1,variables.length); + + + var methods:Array = def.methods; + Assert.assertEquals("unexpected methods length",2,methods.length); + + var accessors:Array = def.accessors; + Assert.assertEquals("unexpected accessors length",3,accessors.length); + + var constructor:MethodDefinition = def.constructorMethod; + Assert.assertEquals("unexpected constructor declaredBy", + "flexUnitTests.reflection.support.TestClass2", + constructor.declaredBy.qualifiedName); + + Assert.assertEquals("unexpected constructor params", + 1, + constructor.parameters.length); + + var meta:Array = def.retrieveMetaDataByName("TestMeta"); + Assert.assertEquals("unexpected class specific meta length", + 1, + meta.length); + + + def = describeType(TestClass4); + Assert.assertEquals("Unexpected package name",def.packageName,"flexUnitTests.reflection.support"); + Assert.assertEquals("Unexpected type name",def.name,"TestClass4"); + + variables = def.variables; + Assert.assertEquals("unexpected variables length",2,variables.length); + + + methods = def.methods; + Assert.assertEquals("unexpected methods length",4,methods.length); + + accessors = def.accessors; + Assert.assertEquals("unexpected accessors length",6,accessors.length); + + constructor = def.constructorMethod; + Assert.assertEquals("unexpected constructor declaredBy", + "flexUnitTests.reflection.support.TestClass4", + constructor.declaredBy.qualifiedName); + + Assert.assertEquals("unexpected constructor params", + 0, + constructor.parameters.length); + + + + } + + + + + [TestVariance(variance="JS",description="Variance in test due to current inability for js target to reflect into non-FlexJS base classes or typedefs")] + [Test] + public function testDescribeTypeClass():void + { + var def:TypeDefinition = describeType(TestClass1); + var expected:*; + Assert.assertEquals("Unexpected package name","flexUnitTests.reflection.support",def.packageName); + Assert.assertEquals("Unexpected type name",def.name,"TestClass1"); + + var variables:Array = def.variables; + Assert.assertEquals("unexpected instance variables length",3,variables.length); + + //there is a difference based on the EventDispatcher inheritance chain differences between js and swf: + expected = isJS ? 4 : 7; + var methods:Array = def.methods; + Assert.assertEquals("unexpected instance methods length",expected,methods.length); + + var accessors:Array = def.accessors; + Assert.assertEquals("unexpected instance accessors length",4,accessors.length); + + var staticVariables:Array =def.staticVariables; + Assert.assertEquals("unexpected static variables length",2,staticVariables.length); + + var staticMethods:Array = def.staticMethods; + Assert.assertEquals("unexpected static methods length",1,staticMethods.length); + //there is a difference based on the native inheritance of readonly 'prototype' not collected from 'Class' (or Object for js): + expected = isJS ? 3 : 4; + var staticAccessors:Array = def.staticAccessors; + Assert.assertEquals("unexpected static accessors length",expected,staticAccessors.length); + + + } + + [TestVariance(variance="JS",description="Variance in test due to current inability for js target to reflect into non-FlexJS base classes or typedefs")] + [Test] + public function testDescribeTypeInstance():void + { + var def:TypeDefinition = describeType(new TestClass1()); + var expected:*; + Assert.assertEquals("Unexpected package name","flexUnitTests.reflection.support",def.packageName); + Assert.assertEquals("Unexpected type name",def.name,"TestClass1"); + + var variables:Array = def.variables; + Assert.assertEquals("unexpected instance variables length",3,variables.length); + + //there is a difference based on the EventDispatcher inheritance chain differences between js and swf: + expected = isJS ? 4 : 7; + var methods:Array = def.methods; + Assert.assertEquals("unexpected instance methods length",expected,methods.length); + + var accessors:Array = def.accessors; + Assert.assertEquals("unexpected instance accessors length",4,accessors.length); + + var staticVariables:Array =def.staticVariables; + Assert.assertEquals("unexpected static variables length",2,staticVariables.length); + + var staticMethods:Array = def.staticMethods; + Assert.assertEquals("unexpected static methods length",1,staticMethods.length); + //there is a difference based on the native inheritance of readonly 'prototype' not collected from 'Class' (or Object for js): + expected = isJS ? 3 : 4; + var staticAccessors:Array = def.staticAccessors; + Assert.assertEquals("unexpected static accessors length",expected,staticAccessors.length); + + + } + + [TestVariance(variance="JS",description="Variance in baseClasses due to current inability for js target to reflect into non-FlexJS base classes or typedefs")] + [Test] + public function testBaseClasses():void{ + var def:TypeDefinition = describeType(TestClass1); + + var baseClasses:Array = def.baseClasses; + var expected:uint = isJS ? 1 : 3; + Assert.assertEquals("unexpected baseclasses length",expected,baseClasses.length); + } + + + [Test] + public function testMemberAccess():void{ + //all of these should succeed without error + var inst:TestClass2 = new TestClass2(""); + var def:TypeDefinition = describeType(inst); + + /** instance variables **/ + + var variables:Array = def.variables; + var variable:VariableDefinition = variables[0]; + Assert.assertEquals("unexpected variable name","testVar",variable.name); + var meta:MetaDataDefinition = variable.retrieveMetaDataByName("TestMeta")[0]; + Assert.assertEquals("unexpected meta name","TestMeta",meta.name); + + var metaArg:MetaDataArgDefinition = meta.getArgsByKey("foo")[0]; + Assert.assertEquals("unexpected meta arg name","foo",metaArg.name); + Assert.assertEquals("unexpected meta arg value","instanceVariable",metaArg.value); + + Assert.assertEquals("unexpected reflection initial variable value","testVar_val",inst[variable.name]); + + var accessors:Array = def.accessors; + var testReadOnly:AccessorDefinition = retrieveItemWithName(accessors,"testReadOnly") as AccessorDefinition; + meta = testReadOnly.retrieveMetaDataByName("TestMeta")[0]; + Assert.assertEquals("unexpected meta name","TestMeta",meta.name); + + metaArg = meta.getArgsByKey("foo")[0]; + Assert.assertEquals("unexpected meta arg name","foo",metaArg.name); + Assert.assertEquals("unexpected meta arg value","instanceAccessor",metaArg.value); + + /** instance accessors **/ + var testWriteOnly:AccessorDefinition = retrieveItemWithName(accessors,"testWriteOnly") as AccessorDefinition; + var testReadWrite:AccessorDefinition = retrieveItemWithName(accessors,"testReadWrite") as AccessorDefinition; + Assert.assertNotNull(testReadOnly); + Assert.assertNotNull(testWriteOnly); + Assert.assertNotNull(testReadWrite); + + Assert.assertEquals("unexpected accessor initial value","instanceAccessor_initial_value",inst[testReadOnly.name]); + Assert.assertEquals("unexpected accessor initial value","instanceAccessor_initial_value",inst[testReadWrite.name]); + + inst[testWriteOnly.name] = "test"; + Assert.assertEquals("unexpected accessor initial value","test",inst[testReadOnly.name]); + Assert.assertEquals("unexpected accessor initial value","test",inst[testReadWrite.name]); + + inst[testReadWrite.name] = "test2"; + Assert.assertEquals("unexpected accessor initial value","test2",inst[testReadOnly.name]); + Assert.assertEquals("unexpected accessor initial value","test2",inst[testReadWrite.name]); + + /** instance methods **/ + var methods:Array = def.methods; + var testMethod:MethodDefinition = retrieveItemWithName(methods,"testMethod") as MethodDefinition; + meta = testMethod.retrieveMetaDataByName("TestMeta")[0]; + Assert.assertEquals("unexpected meta name","TestMeta",meta.name); + + metaArg = meta.getArgsByKey("foo")[0]; + Assert.assertEquals("unexpected meta arg name","foo",metaArg.name); + Assert.assertEquals("unexpected meta arg value","instanceMethod",metaArg.value); + Assert.assertEquals("unexpected parameter count",0,testMethod.parameters.length); + inst[testMethod.name](); + Assert.assertEquals("unexpected method invocation result","testMethod was called",inst[testReadWrite.name]); + + var testMethodWithArgs:MethodDefinition = retrieveItemWithName(methods,"testMethodWithArgs") as MethodDefinition; + Assert.assertEquals("unexpected parameter count",2,testMethodWithArgs.parameters.length); + Assert.assertTrue("unexpected method invocation result",inst[testMethodWithArgs.name]("test")); + Assert.assertFalse("unexpected method invocation result",inst[testMethodWithArgs.name]("test", false)); + Assert.assertEquals("unexpected method invocation result","testMethodWithArgs was called",inst[testReadWrite.name]); + + + + /** static vars **/ + variables = def.staticVariables; + + + variable = variables[0]; + Assert.assertEquals("unexpected variable name","testStaticVar",variable.name); + meta = variable.retrieveMetaDataByName("TestMeta")[0]; + Assert.assertEquals("unexpected meta name","TestMeta",meta.name); + + metaArg = meta.getArgsByKey("foo")[0]; + Assert.assertEquals("unexpected meta arg name","foo",metaArg.name); + Assert.assertEquals("unexpected meta arg value","staticVariable",metaArg.value); + + Assert.assertEquals("unexpected reflection initial variable value","testStaticVar_val",TestClass2[variable.name]); + + /** static accessors **/ + + accessors = def.staticAccessors; + + + testReadOnly = retrieveItemWithName(accessors,"testStaticReadOnly") as AccessorDefinition; + meta = testReadOnly.retrieveMetaDataByName("TestMeta")[0]; + Assert.assertEquals("unexpected meta name","TestMeta",meta.name); + + metaArg = meta.getArgsByKey("foo")[0]; + Assert.assertEquals("unexpected meta arg name","foo",metaArg.name); + Assert.assertEquals("unexpected meta arg value","staticAccessor",metaArg.value); + + + testWriteOnly = retrieveItemWithName(accessors,"testStaticWriteOnly") as AccessorDefinition; + testReadWrite = retrieveItemWithName(accessors,"testStaticReadWrite") as AccessorDefinition; + Assert.assertNotNull(testReadOnly); + Assert.assertNotNull(testWriteOnly); + Assert.assertNotNull(testReadWrite); + + Assert.assertEquals("unexpected accessor initial value","staticAccessor_initial_value",TestClass2[testReadOnly.name]); + Assert.assertEquals("unexpected accessor initial value","staticAccessor_initial_value",TestClass2[testReadWrite.name]); + + TestClass2[testWriteOnly.name] = "test"; + Assert.assertEquals("unexpected accessor initial value","test",TestClass2[testReadOnly.name]); + Assert.assertEquals("unexpected accessor initial value","test",TestClass2[testReadWrite.name]); + + TestClass2[testReadWrite.name] = "test2"; + Assert.assertEquals("unexpected accessor initial value","test2",TestClass2[testReadOnly.name]); + Assert.assertEquals("unexpected accessor initial value","test2",TestClass2[testReadWrite.name]); + + + /** static methods **/ + methods = def.staticMethods; + testMethod = retrieveItemWithName(methods,"testStaticMethod") as MethodDefinition; + meta = testMethod.retrieveMetaDataByName("TestMeta")[0]; + Assert.assertEquals("unexpected meta name","TestMeta",meta.name); + + metaArg = meta.getArgsByKey("foo")[0]; + Assert.assertEquals("unexpected meta arg name","foo",metaArg.name); + Assert.assertEquals("unexpected meta arg value","staticMethod",metaArg.value); + Assert.assertEquals("unexpected parameter count",0,testMethod.parameters.length); + TestClass2[testMethod.name](); + Assert.assertEquals("unexpected method invocation result","testStaticMethod was called",TestClass2[testReadWrite.name]); + + testMethodWithArgs = retrieveItemWithName(methods,"testStaticMethodWithArgs") as MethodDefinition; + Assert.assertEquals("unexpected parameter count",2,testMethodWithArgs.parameters.length); + Assert.assertTrue("unexpected method invocation result",TestClass2[testMethodWithArgs.name]("test")); + Assert.assertFalse("unexpected method invocation result",TestClass2[testMethodWithArgs.name]("test", false)); + Assert.assertEquals("unexpected method invocation result","testStaticMethodWithArgs was called",TestClass2[testReadWrite.name]); + + } + + + [Test] + public function testInterfaceReflection():void{ + var def:TypeDefinition = describeType(ITestInterface4); + Assert.assertEquals("unexpected kind value","interface",def.kind); + Assert.assertEquals("unexpected interfaces length",3,def.interfaces.length); + Assert.assertEquals("unexpected accessors length",1,def.accessors.length); + Assert.assertEquals("unexpected methods length",1,def.methods.length); + + Assert.assertEquals("unexpected variables length",0,def.variables.length); + Assert.assertEquals("unexpected staticVariables length",0,def.staticVariables.length); + Assert.assertEquals("unexpected variables length",0,def.staticMethods.length); + Assert.assertEquals("unexpected staticVariables length",0,def.staticAccessors.length); + Assert.assertNull("unexpected constructor Method definition",def.constructorMethod); + } + + + + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/523eac21/manualtests/UnitTests/src/main/flex/flexUnitTests/reflection/ReflectionTesterTestAlias.as ---------------------------------------------------------------------- diff --git a/manualtests/UnitTests/src/main/flex/flexUnitTests/reflection/ReflectionTesterTestAlias.as b/manualtests/UnitTests/src/main/flex/flexUnitTests/reflection/ReflectionTesterTestAlias.as new file mode 100644 index 0000000..7fd5984 --- /dev/null +++ b/manualtests/UnitTests/src/main/flex/flexUnitTests/reflection/ReflectionTesterTestAlias.as @@ -0,0 +1,90 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 flexUnitTests.reflection +{ + import flexunit.framework.Assert; + import flexUnitTests.reflection.support.*; + import org.apache.flex.reflection.*; + + public class ReflectionTesterTestAlias + { + + public static var isJS:Boolean; + [BeforeClass] + public static function setUpBeforeClass():void + { + var js:Boolean = false; + try { + var check:* = getDefinitionByName("flash.system.Capabilities"); + } catch (e:Error) { + js = true; + } + //if this next reference to 'check' is not included, then the above try/catch code + //appears to be optimized away in js-release mode + //a separate test has been created for this + if (check == null) { + js = true; + } + isJS = js; + } + + [AfterClass] + public static function tearDownAfterClass():void + { + } + + [Before] + public function setUp():void + { + + } + + [After] + public function tearDown():void + { + + } + + + + + [Test] + public function testBasicAlias():void { + //no initial alias + Assert.assertNull(getAliasByClass(TestClass2)); + registerClassAlias("fjsTest", TestClass2); + //alias is registered + Assert.assertEquals("unexpected Alias value","fjsTest",getAliasByClass(TestClass2)); + //register same alias for another class + registerClassAlias("fjsTest", TestClass3); + //original alias mapping is deregistered + Assert.assertNull(getAliasByClass(TestClass2)); + //alias is registered for new class + Assert.assertEquals("unexpected Alias value","fjsTest",getAliasByClass(TestClass3)); + + //class is retrievable by alias + Assert.assertEquals("unexpected Class value",TestClass3,getClassByAlias("fjsTest")); + + + } + + + + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/523eac21/manualtests/UnitTests/src/main/flex/flexUnitTests/reflection/ReflectionTesterTestUseCache.as ---------------------------------------------------------------------- diff --git a/manualtests/UnitTests/src/main/flex/flexUnitTests/reflection/ReflectionTesterTestUseCache.as b/manualtests/UnitTests/src/main/flex/flexUnitTests/reflection/ReflectionTesterTestUseCache.as new file mode 100644 index 0000000..9722647 --- /dev/null +++ b/manualtests/UnitTests/src/main/flex/flexUnitTests/reflection/ReflectionTesterTestUseCache.as @@ -0,0 +1,93 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 flexUnitTests.reflection +{ + import flexunit.framework.Assert; + import flexUnitTests.reflection.support.*; + import org.apache.flex.reflection.*; + + public class ReflectionTesterTestUseCache + { + + public static var isJS:Boolean; + [BeforeClass] + public static function setUpBeforeClass():void + { + var js:Boolean = false; + try { + var check:* = getDefinitionByName("flash.system.Capabilities"); + } catch (e:Error) { + js = true; + } + //if this next reference to 'check' is not included, then the above try/catch code + //appears to be optimized away in js-release mode + //a separate test has been created for this + if (check == null) { + js = true; + } + isJS = js; + } + + [AfterClass] + public static function tearDownAfterClass():void + { + } + + [Before] + public function setUp():void + { + TypeDefinition.useCache = true; + TestClass2.testStaticVar = "testStaticVar_val"; + TestClass2.testStaticWriteOnly = "staticAccessor_initial_value"; + } + + [After] + public function tearDown():void + { + TypeDefinition.useCache = false; + } + + private static function retrieveItemWithName(collection:Array, name:String):DefinitionBase { + var ret:DefinitionBase; + var i:uint=0,l:uint=collection.length; + for (;i<l;i++) { + if (collection[i].name==name) { + ret = collection[i]; + break; + } + } + + return ret; + } + + + [Test] + public function testBasicCache():void { + var def:TypeDefinition = describeType(TestClass2); + + var def2:TypeDefinition = describeType(TestClass2); + + Assert.assertEquals("cache not working",def,def2); + + } + + + + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/523eac21/manualtests/UnitTests/src/main/flex/flexUnitTests/reflection/support/ITestInterface.as ---------------------------------------------------------------------- diff --git a/manualtests/UnitTests/src/main/flex/flexUnitTests/reflection/support/ITestInterface.as b/manualtests/UnitTests/src/main/flex/flexUnitTests/reflection/support/ITestInterface.as new file mode 100644 index 0000000..b5a2249 --- /dev/null +++ b/manualtests/UnitTests/src/main/flex/flexUnitTests/reflection/support/ITestInterface.as @@ -0,0 +1,27 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 flexUnitTests.reflection.support +{ + + public interface ITestInterface + { + function someMethod(compulsoryArg:int, optArg:String=null):TestClass1; + + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/523eac21/manualtests/UnitTests/src/main/flex/flexUnitTests/reflection/support/ITestInterface2.as ---------------------------------------------------------------------- diff --git a/manualtests/UnitTests/src/main/flex/flexUnitTests/reflection/support/ITestInterface2.as b/manualtests/UnitTests/src/main/flex/flexUnitTests/reflection/support/ITestInterface2.as new file mode 100644 index 0000000..f69f9b7 --- /dev/null +++ b/manualtests/UnitTests/src/main/flex/flexUnitTests/reflection/support/ITestInterface2.as @@ -0,0 +1,29 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 flexUnitTests.reflection.support +{ + + public interface ITestInterface2 extends ITestInterface + { + function someMethod2(compulsoryArg:int, optArg:String=null):TestClass1; + + function get someValue2():Boolean; + + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/523eac21/manualtests/UnitTests/src/main/flex/flexUnitTests/reflection/support/ITestInterface3.as ---------------------------------------------------------------------- diff --git a/manualtests/UnitTests/src/main/flex/flexUnitTests/reflection/support/ITestInterface3.as b/manualtests/UnitTests/src/main/flex/flexUnitTests/reflection/support/ITestInterface3.as new file mode 100644 index 0000000..83d05ee --- /dev/null +++ b/manualtests/UnitTests/src/main/flex/flexUnitTests/reflection/support/ITestInterface3.as @@ -0,0 +1,27 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 flexUnitTests.reflection.support +{ + + public interface ITestInterface3 + { + //empty + + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/523eac21/manualtests/UnitTests/src/main/flex/flexUnitTests/reflection/support/ITestInterface4.as ---------------------------------------------------------------------- diff --git a/manualtests/UnitTests/src/main/flex/flexUnitTests/reflection/support/ITestInterface4.as b/manualtests/UnitTests/src/main/flex/flexUnitTests/reflection/support/ITestInterface4.as new file mode 100644 index 0000000..7a032f5 --- /dev/null +++ b/manualtests/UnitTests/src/main/flex/flexUnitTests/reflection/support/ITestInterface4.as @@ -0,0 +1,29 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 flexUnitTests.reflection.support +{ + + public interface ITestInterface4 extends ITestInterface2, ITestInterface3 + { + function someMethod3(compulsoryArg:int, optArg:String=null):TestClass1; + + function get someValue3():Boolean; + + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/523eac21/manualtests/UnitTests/src/main/flex/flexUnitTests/reflection/support/TestClass1.as ---------------------------------------------------------------------- diff --git a/manualtests/UnitTests/src/main/flex/flexUnitTests/reflection/support/TestClass1.as b/manualtests/UnitTests/src/main/flex/flexUnitTests/reflection/support/TestClass1.as new file mode 100644 index 0000000..76ac834 --- /dev/null +++ b/manualtests/UnitTests/src/main/flex/flexUnitTests/reflection/support/TestClass1.as @@ -0,0 +1,91 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 flexUnitTests.reflection.support +{ + + import org.apache.flex.reflection.TypeDefinition; + + [RemoteClass(alias="TestClass1_alias")] + public class TestClass1 implements ITestInterface + { + public function TestClass1() + { + var something:ITestInterface2; + } + + [Bindable] + [Event(name="foo", type="org.apache.flex.events.Event")] + public var bindableVar:String; + [Event(name="foo", type="org.apache.flex.events.Event")] + public var temp:Boolean; + + public static var tempStatic:Boolean; + + public var typeDef:TypeDefinition; + + public var testVar:String="testVar_val"; + + public static var staticTestVar:String="statictestVar_val"; + + private var _atestval:String="accessorTest_val"; + public function get accessorTest():String{ + return _atestval; + } + + public function set accessorTest(val:String):void{ + _atestval = val; + } + + private static var _staticAtestval:String="staticAccessorTest_val"; + public static function get staticAccessorTest():String{ + return _staticAtestval; + } + + public static function set staticAccessorTest(val:String):void{ + _staticAtestval = val; + } + + [Bindable] + public static var bindableStaticVar:String; + + [Bindable] + public var bindableInstanceVar:String; + + + public function someMethod(compulsoryArg:int, optArg:String=null):TestClass1{ + return null; + } + + public static function someStaticMethod(compulsoryArg:int, optArg:String=null):TestClass1{ + return null; + } + + public function get testAccessorType():TypeDefinition { + return null; + } + + public const instanceConstant:String="instanceConstant_val"; + + + public static const staticConstant:String="staticConstant_val"; + + + + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/523eac21/manualtests/UnitTests/src/main/flex/flexUnitTests/reflection/support/TestClass2.as ---------------------------------------------------------------------- diff --git a/manualtests/UnitTests/src/main/flex/flexUnitTests/reflection/support/TestClass2.as b/manualtests/UnitTests/src/main/flex/flexUnitTests/reflection/support/TestClass2.as new file mode 100644 index 0000000..bcc7988 --- /dev/null +++ b/manualtests/UnitTests/src/main/flex/flexUnitTests/reflection/support/TestClass2.as @@ -0,0 +1,103 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 flexUnitTests.reflection.support +{ + + + [TestMeta(foo="class")] + public class TestClass2 + { + //Note: do not change this test class unless you change the related tests to + //support any changes that might appear when testing reflection into it + + public function TestClass2(blah:String){ + + } + + + [TestMeta(foo="instanceMethod")] + public function testMethod():void{ + _testReadWrite = "testMethod was called"; + } + + [TestMeta(foo="instanceMethod")] + public function testMethodWithArgs(mandatory:String,optional:Boolean=true):Boolean{ + _testReadWrite = "testMethodWithArgs was called"; + return optional; + } + + [TestMeta(foo="instanceVariable")] + public var testVar:String = "testVar_val"; + + [TestMeta(foo="instanceAccessor")] + public function get testReadOnly():String{ + return _testReadWrite + } + + [TestMeta(foo="instanceAccessor")] + public function set testWriteOnly(value:String):void{ + _testReadWrite=value; + } + + [TestMeta(foo="instanceAccessor")] + public function get testReadWrite():String{ + return _testReadWrite + } + public function set testReadWrite(value:String):void{ + _testReadWrite=value; + } + + [TestMeta(foo="staticMethod")] + public static function testStaticMethod():void{ + _testStaticReadWrite = "testStaticMethod was called"; + } + + [TestMeta(foo="staticMethod")] + public static function testStaticMethodWithArgs(mandatory:String,optional:Boolean=true):Boolean{ + _testStaticReadWrite = "testStaticMethodWithArgs was called"; + return optional; + } + + [TestMeta(foo="staticVariable")] + public static var testStaticVar:String = "testStaticVar_val"; + + [TestMeta(foo="staticAccessor")] + public static function get testStaticReadOnly():String{ + return _testStaticReadWrite + } + + [TestMeta(foo="staticAccessor")] + public static function set testStaticWriteOnly(value:String):void{ + _testStaticReadWrite = value; + } + + [TestMeta(foo="staticAccessor")] + public static function get testStaticReadWrite():String{ + return _testStaticReadWrite; + } + public static function set testStaticReadWrite(value:String):void{ + _testStaticReadWrite = value; + } + + + + private static var _testStaticReadWrite:String = "staticAccessor_initial_value"; + private var _testReadWrite:String = "instanceAccessor_initial_value"; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/523eac21/manualtests/UnitTests/src/main/flex/flexUnitTests/reflection/support/TestClass3.as ---------------------------------------------------------------------- diff --git a/manualtests/UnitTests/src/main/flex/flexUnitTests/reflection/support/TestClass3.as b/manualtests/UnitTests/src/main/flex/flexUnitTests/reflection/support/TestClass3.as new file mode 100644 index 0000000..0b4c59b --- /dev/null +++ b/manualtests/UnitTests/src/main/flex/flexUnitTests/reflection/support/TestClass3.as @@ -0,0 +1,39 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 flexUnitTests.reflection.support +{ + + + + public class TestClass3 extends TestClass1 implements ITestInterface2, ITestInterface3 + { + + public var something:String; + + + public function someMethod2(compulsoryArg:int, optArg:String=null):TestClass1 + { + return null; + } + + public function get someValue2():Boolean { + return false; + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/523eac21/manualtests/UnitTests/src/main/flex/flexUnitTests/reflection/support/TestClass4.as ---------------------------------------------------------------------- diff --git a/manualtests/UnitTests/src/main/flex/flexUnitTests/reflection/support/TestClass4.as b/manualtests/UnitTests/src/main/flex/flexUnitTests/reflection/support/TestClass4.as new file mode 100644 index 0000000..5d0a28f --- /dev/null +++ b/manualtests/UnitTests/src/main/flex/flexUnitTests/reflection/support/TestClass4.as @@ -0,0 +1,95 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 flexUnitTests.reflection.support +{ + + + + public class TestClass4 extends TestClass2 + { + //Note: do not change this test class unless you change the related tests to + //support any changes that might appear when testing reflection into it + + public function TestClass4(){ + super(""); + } + + + [TestMeta(foo="instanceMethod")] + public function testMethod2():void{ + + } + + [TestMeta(foo="instanceMethod")] + public function testMethodWithArgs2(mandatory:String,optional:Boolean=true):void{ + + } + + [TestMeta(foo="instanceVariable")] + public var testVar2:String; + + [TestMeta(foo="instanceAccessor")] + public function get testReadonly2():String{ + return null + } + + [TestMeta(foo="instanceAccessor")] + public function set testWriteonly2(value:String):void{ + + } + + [TestMeta(foo="instanceAccessor")] + public function get testReadeWrite2():String{ + return null + } + public function set testReadeWrite2(value:String):void{ + + } + + [TestMeta(foo="staticMethod")] + public static function testStaticMethod():void{ + } + + [TestMeta(foo="staticMethod")] + public static function testStaticMethodWithArgs(mandatory:String,optional:Boolean=true):void{ + } + + [TestMeta(foo="staticVariable")] + public static var testStaticVar:String; + + [TestMeta(foo="staticAccessor")] + public static function get testStaticReadonly():String{ + return null + } + + [TestMeta(foo="staticAccessor")] + public static function set testStaticWriteonly(value:String):void{ + + } + + [TestMeta(foo="staticAccessor")] + public static function get testStaticReadeWrite():String{ + return null + } + public static function set testStaticReadeWrite(value:String):void{ + + } + + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/523eac21/manualtests/UnitTests/src/main/flex/flexUnitTests/reflection/support/TestClass5.as ---------------------------------------------------------------------- diff --git a/manualtests/UnitTests/src/main/flex/flexUnitTests/reflection/support/TestClass5.as b/manualtests/UnitTests/src/main/flex/flexUnitTests/reflection/support/TestClass5.as new file mode 100644 index 0000000..cc546c7 --- /dev/null +++ b/manualtests/UnitTests/src/main/flex/flexUnitTests/reflection/support/TestClass5.as @@ -0,0 +1,82 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 flexUnitTests.reflection.support +{ + + + + public class TestClass5 + { + //Note: do not change this test class unless you change the related tests to + //support any changes that might appear when testing reflection into it + + public function TestClass5(){ + + } + + + [TestMeta(foo="instanceMethod")] + public function method():void{ + + } + + [TestMeta(foo="instanceMethod")] + public function methodWithArgs(mandatory:String,optional:Boolean=true):void{ + + } + + [TestMeta(foo="instanceVariable")] + public var testVar:String; + + [TestMeta(foo="instanceAccessor")] + public function get testGetter():String{ + return null + } + + [TestMeta(foo="instanceAccessor")] + public function set testSetter(value:String):void{ + + } + + + [TestMeta(foo="staticMethod")] + public static function method():void{ + } + + [TestMeta(foo="staticMethod")] + public static function methodWithArgs(mandatory:String,optional:Boolean=true):void{ + } + + [TestMeta(foo="staticVariable")] + public static var testVar:String; + + [TestMeta(foo="staticAccessor")] + public static function get testGetter():String{ + return null + } + + [TestMeta(foo="staticAccessor")] + public static function set testSetter(value:String):void{ + + } + + + + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/523eac21/manualtests/UnitTests/src/main/flex/flexunit/framework/Assert.as ---------------------------------------------------------------------- diff --git a/manualtests/UnitTests/src/main/flex/flexunit/framework/Assert.as b/manualtests/UnitTests/src/main/flex/flexunit/framework/Assert.as new file mode 100644 index 0000000..171f695 --- /dev/null +++ b/manualtests/UnitTests/src/main/flex/flexunit/framework/Assert.as @@ -0,0 +1,305 @@ +/* + * 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 flexunit.framework +{ + //import flexunit.framework.AssertionFailedError; + + /** + * A set of assert methods. Messages are only displayed when an assert fails. + */ + public class Assert + { + /** + * @private + */ + public static var _assertCount:uint = 0; + + /** + * Returns the number of assertions that have been made + */ + public static function get assertionsMade() : uint { + return _assertCount; + } + + + /** + * Resets the count for the number of assertions that have been made back to zero + */ + public static function resetAssertionsFields() : void { + _assertCount = 0; + } + + /** + * @private + */ + public static function assertWithApply( asserter:Function, args:Array ):void { + _assertCount++; + asserter.apply( null, args ); + } + + /** + * @private + */ + public static function assertWith( asserter:Function, ...rest ):void { + _assertCount++; + asserter.apply( null, rest ); + } + + /** + * Asserts that two provided values are equal. + * + * @param asserter The function to use for assertion. + * @param rest + * Must be passed at least 2 arguments of type Object to compare for equality. + * If three arguments are passed, the first argument must be a String + * and will be used as the error message. + * The first of the comparison arguments represents the expected result + * The second is the actual result to compare with the expected result. + * + * <code>assertEquals( String, Object, Object );</code> + * <code>assertEquals( Object, Object );</code> + */ + public static function assertEquals(... rest):void + { + _assertCount++; + if ( rest.length == 3 ) + failNotEquals( rest[0], rest[1], rest[2] ); + else + failNotEquals( "", rest[0], rest[1] ); + } + + /** + * @private + */ + public static function failNotEquals( message:String, expected:Object, actual:Object ):void + { + if ( expected != actual ) + failWithUserMessage( message, "expected:<" + expected + "> but was:<" + actual + ">" ); + } + + /** + * /** + * Asserts that the provided values are strictly equal. + * + * @param rest + * Must be passed at least 2 arguments of type Object to compare for strict equality. + * If three arguments are passed, the first argument must be a String + * and will be used as the error message. + * The first of the comparison arguments represents the expected result + * The second is the actual result to compare with the expected result. + * + * <code>assertStrictlyEquals( String, Object, Object );</code> + * <code>assertStrictlyEquals( Object, Object );</code> + */ + public static function assertStrictlyEquals(... rest):void + { + _assertCount++; + if ( rest.length == 3 ) + failNotStrictlyEquals( rest[0], rest[1], rest[2] ); + else + failNotStrictlyEquals( "", rest[0], rest[1] ); + } + + /** + * @private + */ + public static function failNotStrictlyEquals( message:String, expected:Object, actual:Object ):void + { + if ( expected !== actual ) + failWithUserMessage( message, "expected:<" + expected + "> but was:<" + actual + ">" ); + } + + /** + * Asserts that a condition is true. + * + * @param rest + * Accepts an argument of type Boolean. + * If two arguments are passed the first argument must be a String + * and will be used as the error message. + * + * <code>assertTrue( String, Boolean );</code> + * <code>assertTrue( Boolean );</code> + */ + public static function assertTrue(... rest):void + { + _assertCount++; + if ( rest.length == 2 ) + failNotTrue( rest[0], rest[1] ); + else + failNotTrue( "", rest[0] ); + } + + /** + * Asserts that a condition is not true. + * + * @param rest + * Accepts an argument of type Boolean. + * If two arguments are passed the first argument must be a String + * and will be used as the error message. + * + * <code>assertTrue( String, Boolean );</code> + * <code>assertTrue( Boolean );</code> + */ + public static function failNotTrue( message:String, condition:Boolean ):void + { + if ( !condition ) + failWithUserMessage( message, "expected true but was false" ); + } + + /** + * Asserts that a condition is false. + * + * @param rest + * Accepts an argument of type Boolean. + * If two arguments are passed the first argument must be a String + * and will be used as the error message. + * + * <code>assertFalse( String, Boolean );</code> + * <code>assertFalse( Boolean );</code> + */ + public static function assertFalse(... rest):void + { + _assertCount++; + if ( rest.length == 2 ) + failTrue( rest[0], rest[1] ); + else + failTrue( "", rest[0] ); + } + + /** + * Asserts that a condition is false. + * + * @param rest + * Accepts an argument of type Boolean. + * If two arguments are passed the first argument must be a String + * and will be used as the error message. + * + * <code>assertTrue( String, Boolean );</code> + * <code>assertTrue( Boolean );</code> + */ + public static function failTrue( message:String, condition:Boolean ):void + { + if ( condition ) + failWithUserMessage( message, "expected false but was true" ); + } + + //TODO: (<code>null</code> okay) needs removal? + /** + * Asserts that an object is null. + * + * @param rest + * Accepts an argument of type Object. + * If two arguments are passed the first argument must be a String + * and will be used as the error message. + * + * <code>assertNull( String, Object );</code> + * <code>assertNull( Object );</code> + * + */ + public static function assertNull(... rest):void + { + _assertCount++; + if ( rest.length == 2 ) + failNotNull( rest[0], rest[1] ); + else + failNotNull( "", rest[0] ); + } + + /** + * Asserts that an object is not null. + * + * @param rest + * Accepts an argument of type Boolean. + * If two arguments are passed the first argument must be a String + * and will be used as the error message. + * + * <code>assertTrue( String, Boolean );</code> + * <code>assertTrue( Boolean );</code> + */ + public static function failNull( message:String, object:Object ):void + { + if ( object == null ) + failWithUserMessage( message, "object was null: " + object ); + } + + //TODO: (<code>null</code> okay) needs removal? + /** + * Asserts that an object is not null. + * + * @param rest + * Accepts an argument of type Object. + * If two arguments are passed the first argument must be a String + * and will be used as the error message. + * + * <code>assertNotNull( String, Object );</code> + * <code>assertNotNull( Object );</code> + */ + public static function assertNotNull(... rest):void + { + _assertCount++; + if ( rest.length == 2 ) + failNull( rest[0], rest[1] ); + else + failNull( "", rest[0] ); + } + + /** + * Asserts that an object is not null. + * + * @param rest + * Accepts an argument of type Boolean. + * If two arguments are passed the first argument must be a String + * and will be used as the error message. + * + * <code>assertTrue( String, Boolean );</code> + * <code>assertTrue( Boolean );</code> + */ + public static function failNotNull( message:String, object:Object ):void + { + if ( object != null ) + failWithUserMessage( message, "object was not null: " + object ); + } + //TODO: (<code>null</code> okay) needs removal? + /** + * Fails a test with the argument message. + * + * @param failMessage + * the identifying message for the <code> AssertionFailedError</code> (<code>null</code> + * okay) + * @see AssertionFailedError + */ + public static function fail( failMessage:String = ""):void + { + var error:AssertionFailedError = new AssertionFailedError(failMessage); + //this seems necessary for js: + if (error.message!=failMessage) error.message = failMessage; + throw error; + } + + + /** + * @private + */ + private static function failWithUserMessage( userMessage:String, failMessage:String ):void + { + if ( userMessage.length > 0 ) + userMessage = userMessage + " - "; + failMessage = userMessage + failMessage; + fail(failMessage); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/523eac21/manualtests/UnitTests/src/main/flex/flexunit/framework/AssertionFailedError.as ---------------------------------------------------------------------- diff --git a/manualtests/UnitTests/src/main/flex/flexunit/framework/AssertionFailedError.as b/manualtests/UnitTests/src/main/flex/flexunit/framework/AssertionFailedError.as new file mode 100644 index 0000000..359361f --- /dev/null +++ b/manualtests/UnitTests/src/main/flex/flexunit/framework/AssertionFailedError.as @@ -0,0 +1,39 @@ +/* + * 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 flexunit.framework +{ + /** + * <code>Error</code> class used for failures in assertions + * + * @see Assert + */ + public class AssertionFailedError extends Error + { + /** + * Throws a new <code>Error</code> of type <code>AssertionError</code> + * with the passed in message + * + * @param message The message associated with the error (<code>null</code> okay) + * @param id The id of the error if desired (<code>null</code> okay) + */ + public function AssertionFailedError(message:String="", id:int=0) + { + super(message, id); + } + + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/523eac21/manualtests/UnitTests/src/main/flex/testshim/FlexJSUnitTestRunner.as ---------------------------------------------------------------------- diff --git a/manualtests/UnitTests/src/main/flex/testshim/FlexJSUnitTestRunner.as b/manualtests/UnitTests/src/main/flex/testshim/FlexJSUnitTestRunner.as new file mode 100644 index 0000000..7494963 --- /dev/null +++ b/manualtests/UnitTests/src/main/flex/testshim/FlexJSUnitTestRunner.as @@ -0,0 +1,186 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 testshim { + +import org.apache.flex.reflection.MetaDataArgDefinition; +import org.apache.flex.reflection.MetaDataDefinition; +import org.apache.flex.reflection.MethodDefinition; +import org.apache.flex.reflection.TypeDefinition; +import org.apache.flex.reflection.describeType; + +import flexunit.framework.Assert; +public class FlexJSUnitTestRunner { + + + public function FlexJSUnitTestRunner(testerClass:Class, notificationReceiver:Function) { + this.testerClass = testerClass; + this.callback = notificationReceiver; + prepare(); + } + + private var testerClass:Class; + private var callback:Function; + + private var _testingName:String; + public function get testingName():String{ + return _testingName; + } + private var _successCount:uint=0; + public function get successCount():uint { + return _successCount; + } + + private var _failCount:uint=0; + public function get failCount():uint { + return _failCount; + } + + private var _successfulAssertions:uint=0; + public function get successfulAssertions():uint { + return _successfulAssertions; + } + + private var beforeClassFunc:Function; + private var afterClassFunc:Function; + private var setupFunc:MethodDefinition; + private var tearDownFunc:MethodDefinition; + + private var testMethods:Array=[]; + + private function prepare():void{ + var typeDef:TypeDefinition = describeType(testerClass); + _testingName = typeDef.name; + var staticMethods:Array = typeDef.staticMethods; + for each (var methodDef:MethodDefinition in staticMethods) { + var beforeClass:Array = methodDef.retrieveMetaDataByName("BeforeClass"); + var afterClass:Array = methodDef.retrieveMetaDataByName("AfterClass"); + if ( beforeClass.length ) { + if (beforeClassFunc!=null) throw new Error("BeforeClass used more than once in "+typeDef.qualifiedName); + beforeClassFunc = testerClass[methodDef.name]; + } + if ( afterClass.length ) { + if (afterClassFunc!=null) throw new Error("AfterClass used more than once in "+typeDef.qualifiedName); + afterClassFunc = testerClass[methodDef.name]; + } + } + var methods:Array = typeDef.methods; + for each (methodDef in methods) { + var beforeTests:Array = methodDef.retrieveMetaDataByName("Before"); + var afterTests:Array = methodDef.retrieveMetaDataByName("After"); + if ( beforeTests.length ) { + if (setupFunc!=null) throw new Error("Before used more than once in "+typeDef.qualifiedName); + setupFunc = methodDef; + } + if ( afterTests.length ) { + if (tearDownFunc!=null) throw new Error("After used more than once in "+typeDef.qualifiedName); + tearDownFunc = methodDef; + } + var test:Array = methodDef.retrieveMetaDataByName("Test"); + if (test.length) { + testMethods.push(methodDef); + } + testMethods.sortOn("name"); + } + + if (testMethods.length == 0) { + throw new Error("Zero test methods detected in "+typeDef.qualifiedName+", check to make sure -keep-as3-metadata is configured"); + } + } + + private function begin():void { + if (beforeClassFunc!=null) beforeClassFunc(); + } + + public function runTests():void{ + begin(); + var testInstance:Object = new testerClass(); + if (setupFunc!=null) { + testInstance[setupFunc.name](); + } + var i:uint=0, l:uint=testMethods.length; + + for(;i<l;i++) { + runFlexJSTest(_testingName,testInstance,testMethods[i],callback); + } + + if (tearDownFunc!=null) { + testInstance[tearDownFunc.name](); + } + end(); + } + + private function end():void{ + if (afterClassFunc!=null) afterClassFunc(); + } + + + private function runFlexJSTest(testClass:String,instance:Object,methodDef:MethodDefinition,callback:Function=null):void{ + var methodName:String = methodDef.name; + trace('running test in '+testClass+":"+methodName); + var varianceMetas:Array = methodDef.retrieveMetaDataByName("TestVariance"); + + var method:Function = instance[methodName]; + var preAssertCount:uint = Assert.assertionsMade; + var result:TestResult = new TestResult(); + result.assertions = 0; + result.pass = true; + result.error = null; + result.testClass = testClass; + result.testMethod = methodName; + + while (varianceMetas.length) { + var varianceMeta:MetaDataDefinition = varianceMetas.shift(); + var varianceArgs:Array = varianceMeta.getArgsByKey("variance"); + var i:uint=0, l:uint= varianceArgs.length; + if (l) { + result.hasVariance=true; + for(;i<l;i++) varianceArgs[i] = varianceArgs[i].value; + result.varianceTarget = varianceArgs.join(","); + } + if (result.hasVariance) { + var descriptionArgs:Array= varianceMeta.getArgsByKey("description"); + if (descriptionArgs.length) result.varianceDescription = ""; + while(descriptionArgs.length) { + var description:MetaDataArgDefinition = descriptionArgs.shift(); + result.varianceDescription +=description.value; + if (descriptionArgs.length) result.varianceDescription += ", "; + } + } + } + //run the test method + try { + method(); + } catch (e:Error) { + result.pass=false; + result.error = e.name+":" + e.message; + } + result.assertions = Assert.assertionsMade - preAssertCount; + if (preAssertCount == Assert.assertionsMade) { + result.warning = "WARNING: This test method appears to have zero Assertions"; + } + if (result.pass) _successCount++; + else _failCount++; + _successfulAssertions += result.assertions; + if (callback!=null) { + callback(result); + } + } + +} +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/523eac21/manualtests/UnitTests/src/main/flex/testshim/TestResult.as ---------------------------------------------------------------------- diff --git a/manualtests/UnitTests/src/main/flex/testshim/TestResult.as b/manualtests/UnitTests/src/main/flex/testshim/TestResult.as new file mode 100644 index 0000000..d9bc514 --- /dev/null +++ b/manualtests/UnitTests/src/main/flex/testshim/TestResult.as @@ -0,0 +1,56 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 testshim { +public class TestResult { + public function TestResult() { + } + + public var testClass:String; + + public var testMethod:String; + + public var pass:Boolean; + + public var assertions:uint; + + public var error:String; + + public var hasVariance:Boolean; + + public var varianceTarget:String; + + public var varianceDescription:String; + + public var warning:String; + + public function toString(newline:String=null):String { + if (newline==null) newline="\n"; + var s:String=""; + var postFix:String = testMethod+" in "+testClass; + if (pass) { + s += "PASSED ("+assertions+" assertions made) ["+postFix+"]"; + } else { + s += "FAILED ( at assertion "+assertions+" in test method) ["+postFix+"]"+newline; + s += "["+error+"]"; + } + return s; + } + +} +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/523eac21/manualtests/UnitTests/testsview/image/Flex.png ---------------------------------------------------------------------- diff --git a/manualtests/UnitTests/testsview/image/Flex.png b/manualtests/UnitTests/testsview/image/Flex.png new file mode 100644 index 0000000..cb68fec Binary files /dev/null and b/manualtests/UnitTests/testsview/image/Flex.png differ http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/523eac21/manualtests/UnitTests/testsview/index.html ---------------------------------------------------------------------- diff --git a/manualtests/UnitTests/testsview/index.html b/manualtests/UnitTests/testsview/index.html new file mode 100644 index 0000000..3007ab8 --- /dev/null +++ b/manualtests/UnitTests/testsview/index.html @@ -0,0 +1,129 @@ +<!-- + 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. +--> +<!DOCTYPE html> +<html> +<head> + <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> + <style> + .boxLeft { + display:inline-block; + width:50% ; + position:absolute; + top:100px; + bottom:15px; + left:0px + } + .boxRight { + display:inline-block; + width:50% ; + position:absolute; + top:100px; + bottom:15px; + right:0px + } + .pageStyles { + font-family: Arial,sans-serif; + color: #333; + background: #f5f5f5; + font-size: 14px; + line-height: 1.5; + } + h1 { + font-size: 28px; + line-height: 1.25; + font-weight: normal; + } + em { + font-weight: bold; + } + .logo { + margin-right: 10px; + float: left; + width: 48px; + height: 48px; + border-radius: 50%; + border: 0; + margin: 0; + padding: 0; + } + .titleContent { + white-space:nowrap; + } + </style> + <script type="text/javascript"> + + console.API; + + if (typeof console._commandLineAPI !== 'undefined') { + console.API = console._commandLineAPI; //chrome + } else if (typeof console._inspectorCommandLineAPI !== 'undefined') { + console.API = console._inspectorCommandLineAPI; //Safari + } else if (typeof console.clear !== 'undefined') { + console.API = console; + } + + function swapJSBuild() { + var button = document.getElementById("swapJsButton"); + var JS_RELEASE = "JS-Release"; + var JS_DEBUG = "JS-Debug"; + var SWAP_TO_RELEASE = "Swap To "+JS_RELEASE; + var SWAP_TO_DEBUG = "Swap To "+JS_DEBUG; + var base = "../target/javascript/bin"; + var debug = base + "/js-debug/index.html"; + var release = base + "/js-release/index.html"; + var jsIframe = document.getElementById("jsIframe"); + var status = document.getElementById("jsStatus"); + if (button && jsIframe) { + var current = button.innerHTML; + switch (current) { + case SWAP_TO_RELEASE: + console.API.clear(); + button.innerHTML = SWAP_TO_DEBUG; + jsIframe.src = release; + status.innerHTML = "Currently showing <em>"+JS_RELEASE+"</em>";; + break; + case SWAP_TO_DEBUG: + console.API.clear(); + button.innerHTML = SWAP_TO_RELEASE; + jsIframe.src = debug; + status.innerHTML = "Currently showing <em>"+JS_DEBUG+"</em>"; + break; + } + } + } + </script> +</head> +<body class="pageStyles"> + <div> + <div > + <img class="logo" src="image/Flex.png" alt="Apache Flex logo"> + <div class="titleContent"> + <h1>FlexJS Framework Development Unit Tests</h1> + </div> + <div id="jsStatus" style="position: relative; display: inline-block;">Currently showing <em>JS-Debug</em></div> + <button id="swapJsButton" onclick="swapJSBuild()" type="button" class="quoteButton TextButton" style="position: relative; display: inline-block;">Swap To JS-Release</button> + </div> + <div class="boxLeft"> + <iframe id="jsIframe" src="../target/javascript/bin/js-debug/index.html" frameborder="1" scrolling="no" height="100%" width="100%" align="left" ></iframe> + </div> + <div class="boxRight"> + <iframe id="swfIframe" src="../target/bin-debug/UnitTests.html" frameborder="1" scrolling="no" height="100%" width="100%" align="left" ></iframe> + </div> + </div> +</body> +</html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/523eac21/manualtests/XMLTest/build.xml ---------------------------------------------------------------------- diff --git a/manualtests/XMLTest/build.xml b/manualtests/XMLTest/build.xml index a3012b2..c811bba 100644 --- a/manualtests/XMLTest/build.xml +++ b/manualtests/XMLTest/build.xml @@ -22,52 +22,26 @@ <project name="xmltest" default="main" basedir="."> <property name="FLEXJS_HOME" location="../.."/> <property name="example" value="XMLTest" /> + <!-- use this to add keep metadata option --> + <property name="theme_arg" value="-keep-as3-metadata+=Event" /> <property name="swf.version" value="11" /> + <property file="${FLEXJS_HOME}/env.properties"/> <property environment="env"/> - <property file="${FLEXJS_HOME}/build.properties"/> + <property file="${FLEXJS_HOME}/build.properties"/> <property name="FLEX_HOME" value="${FLEXJS_HOME}"/> - <!-- use this to add keep metadata option --> - <property name="theme_arg" value="-keep-as3-metadata+=Event" /> - <available file="${env.FALCON_HOME}/lib/falcon-mxmlc.jar" - type="file" - property="FALCON_HOME" - value="${env.FALCON_HOME}"/> - - <available file="${FLEXJS_HOME}/../flex-falcon/compiler/generated/dist/sdk/lib/falcon-mxmlc.jar" - type="file" - property="FALCON_HOME" - value="${FLEXJS_HOME}/../flex-falcon/compiler/generated/dist/sdk"/> - - <available file="${env.FALCONJX_HOME}/lib/jsc.jar" - type="file" - property="FALCONJX_HOME" - value="${env.FALCONJX_HOME}"/> - - <available file="${FLEXJS_HOME}/../flex-falcon/compiler-jx/lib/jsc.jar" - type="file" - property="FALCONJX_HOME" - value="${FLEXJS_HOME}/../flex-falcon/compiler-jx"/> - - <available file="${env.GOOG_HOME}/closure/goog/base.js" - type="file" - property="GOOG_HOME" - value="${env.GOOG_HOME}"/> - - <available file="${FLEXJS_HOME}/js/lib/google/closure-library/closure/goog/base.js" - type="file" - property="GOOG_HOME" - value="${FLEXJS_HOME}/js/lib/google/closure-library"/> + <include file="${basedir}/../build_example.xml" /> - <target name="main" depends="clean,build_example.compile,build_example.compilejs" description="Clean build of FlexJSUI.swc"> + <target name="main" depends="clean,build_example.compile" description="Clean build of ${example}"> </target> <target name="clean"> <delete dir="${basedir}/bin" failonerror="false" /> <delete dir="${basedir}/bin-debug" failonerror="false" /> <delete dir="${basedir}/bin-release" failonerror="false" /> + <delete dir="${basedir}/target" failonerror="false" /> </target> </project>
