├── .gitignore ├── MIT-LICENSE.txt ├── README.textile ├── asunit-2.0 ├── MIT-LICENSE.txt ├── README.textile ├── Sys.as └── src │ └── com │ └── asunit │ ├── controls │ ├── LocalOutputPanel.as │ ├── LocalOutputPanelTest.as │ ├── LocalOutputPanelTextArea.as │ ├── LocalOutputPanelTextAreaTest.as │ ├── LocalOutputPanelTitleBar.as │ ├── ResizeHandle.as │ ├── ScrollArrow.as │ ├── ScrollHandle.as │ ├── ScrollListener.as │ ├── TextScroller.as │ └── shapes │ │ ├── Rectangle.as │ │ └── Triangle.as │ ├── framework │ ├── AsUnit.as │ ├── Assert.as │ ├── Assertion.as │ ├── Reflection.as │ ├── Test.as │ ├── TestCase.as │ ├── TestCaseXml.as │ ├── TestFailure.as │ ├── TestResult.as │ ├── TestRunner.as │ ├── TestSetup.as │ └── TestSuite.as │ ├── ui │ ├── Main.as │ ├── RemoteVersion.as │ └── SuccessMeter.as │ └── util │ ├── Comparable.as │ ├── EventListener.as │ ├── EventSource.as │ ├── LocalConnClient.as │ ├── LocalConnGateway.as │ ├── LocalConnServer.as │ ├── LocalMessageBroker.as │ ├── Observable.as │ └── TextFile.as ├── asunit-2.5 ├── AsUnitRunner.fla ├── MIT-LICENSE.txt ├── README.textile ├── rakefile.rb ├── src │ └── asunit │ │ ├── errors │ │ ├── AssertionFailedError.as │ │ ├── ClassNameUndefinedError.as │ │ ├── ClassNotFoundError.as │ │ ├── InstanceNotFoundError.as │ │ └── UnimplementedFeatureError.as │ │ ├── flash │ │ ├── errors │ │ │ └── IllegalOperationError.as │ │ ├── events │ │ │ ├── Event.as │ │ │ ├── EventDispatcher.as │ │ │ ├── IEventDispatcher.as │ │ │ └── TimerEvent.as │ │ └── utils │ │ │ └── Timer.as │ │ ├── framework │ │ ├── Assert.as │ │ ├── AsyncOperation.as │ │ ├── ITestListener.as │ │ ├── Test.as │ │ ├── TestCase.as │ │ ├── TestCaseExample.as │ │ ├── TestCaseMock.as │ │ ├── TestFailure.as │ │ ├── TestListener.as │ │ ├── TestMethod.as │ │ ├── TestResult.as │ │ └── TestSuite.as │ │ ├── runner │ │ ├── BaseTestRunner.as │ │ ├── IResultPrinter.as │ │ ├── TestSuiteLoader.as │ │ └── Version.as │ │ ├── textui │ │ ├── ResultPrinter.as │ │ ├── SuccessBar.as │ │ ├── TestRunner.as │ │ ├── XMLResultPrinter.as │ │ └── XMLTestResult.as │ │ └── util │ │ ├── ArrayIterator.as │ │ ├── ArrayIteratorTest.as │ │ ├── ArrayUtil.as │ │ ├── Iterator.as │ │ └── Properties.as └── test │ ├── AllTests.as │ ├── AsUnitRunner.as │ └── asunit │ ├── AllTests.as │ ├── framework │ ├── AllTests.as │ ├── AssertTest.as │ ├── AsyncMethodTest.as │ ├── MockData.xml │ ├── TestCaseStub.as │ ├── TestCaseTest.as │ ├── TestFailureTest.as │ └── VisualTestCaseTest.as │ ├── runner │ └── BaseTestRunnerMock.as │ ├── textui │ ├── AllTests.as │ ├── TestRunnerTest.as │ └── TestRunnerTestCaseMock.as │ └── util │ ├── AllTests.as │ └── ArrayIteratorTest.as ├── asunit-3.0 ├── MIT-LICENSE.txt ├── README.textile ├── examples │ └── asunit │ │ ├── framework │ │ ├── AsynchronousTestMethodExample.as │ │ ├── ComponentTestExample.as │ │ ├── ComponentTestIntroduction.as │ │ ├── ComponentUnderTest.as │ │ ├── MathUtil.as │ │ ├── MathUtilTest.as │ │ └── TestSuiteExample.as │ │ └── textui │ │ ├── AirRunnerExample.mxml │ │ ├── FlexRunnerExample.mxml │ │ ├── TestRunnerExample.as │ │ ├── XMLResultPrinterExample.as │ │ └── XMLResultPrinterExample.xml ├── rakefile.rb ├── src │ ├── AsUnit.as │ └── asunit │ │ ├── errors │ │ ├── AbstractError.as │ │ ├── AssertionFailedError.as │ │ ├── ClassNotFoundError.as │ │ ├── InstanceNotFoundError.as │ │ └── UnimplementedFeatureError.as │ │ ├── framework │ │ ├── Assert.as │ │ ├── AsyncOperation.as │ │ ├── AsynchronousHTTPServiceTestCase.as │ │ ├── AsynchronousTestCase.as │ │ ├── AsynchronousTestCaseExample.as │ │ ├── RemotingTestCase.as │ │ ├── Test.as │ │ ├── TestCase.as │ │ ├── TestCaseExample.as │ │ ├── TestFailure.as │ │ ├── TestListener.as │ │ ├── TestMethod.as │ │ ├── TestResult.as │ │ └── TestSuite.as │ │ ├── runner │ │ ├── BaseTestRunner.as │ │ ├── TestSuiteLoader.as │ │ └── Version.as │ │ ├── textui │ │ ├── AirRunner.as │ │ ├── FlexRunner.as │ │ ├── FlexTestRunner.as │ │ ├── ResultPrinter.as │ │ ├── TestRunner.as │ │ ├── TestTime.as │ │ └── XMLResultPrinter.as │ │ └── util │ │ ├── ArrayIterator.as │ │ ├── Iterator.as │ │ └── Properties.as └── test │ ├── AllTests.as │ ├── AsUnitRunner.as │ └── asunit │ ├── AllTests.as │ ├── framework │ ├── AllTests.as │ ├── AssertEqualsArraysIgnoringOrderTest.as │ ├── AssertEqualsArraysTest.as │ ├── AssertTest.as │ ├── AssertThrowsTest.as │ ├── AsyncFailureTest.as │ ├── AsyncMethodTest.as │ ├── MockData.xml │ ├── TestCaseMock.as │ ├── TestCaseTest.as │ ├── TestFailureTest.as │ ├── VisualTestCaseTest.as │ └── assertAssertionFailed.as │ ├── runner │ └── BaseTestRunnerMock.as │ ├── textui │ ├── AllTests.as │ ├── TestRunnerTest.as │ └── TestRunnerTestCaseMock.as │ └── util │ ├── AllTests.as │ └── ArrayIteratorTest.as └── asunit-4.0 ├── .as3_classpath ├── .gitignore ├── Gemfile ├── MIT-LICENSE.txt ├── README.textile ├── air ├── AIR2Runner.mxml └── AIR2RunnerDescriptor.xml ├── asunit4.gemspec ├── build.xml ├── docs └── presentation │ └── WhatsNew.key ├── lib ├── Reflection.swc ├── SwiftSuspenders-v1.5.1.swc ├── airframework.swc ├── airglobal.swc └── flexUnitTasks.jar ├── rakefile.rb ├── sprout ├── lib │ ├── asunit4.rb │ └── asunit4 │ │ ├── suite_class_generator.rb │ │ ├── templates │ │ ├── AsUnit4SuiteClass.as │ │ └── AsUnit4TestClass.as │ │ └── test_class_generator.rb └── test │ └── unit │ ├── test_class_generator_test.rb │ └── test_helper.rb ├── src └── asunit │ ├── asserts │ ├── assertEquals.as │ ├── assertEqualsArrays.as │ ├── assertEqualsArraysIgnoringOrder.as │ ├── assertEqualsFloat.as │ ├── assertFalse.as │ ├── assertMatches.as │ ├── assertNotNull.as │ ├── assertNotSame.as │ ├── assertNull.as │ ├── assertSame.as │ ├── assertThrows.as │ ├── assertThrowsWithMessage.as │ ├── assertTrue.as │ └── fail.as │ ├── core │ ├── AsUnitCore.as │ ├── FlashBuilderCore.as │ ├── FlashDevelopCore.as │ ├── FlexUnitCICore.as │ └── TextCore.as │ ├── errors │ ├── AbstractError.as │ ├── AssertionFailedError.as │ ├── ClassNotFoundError.as │ ├── InstanceNotFoundError.as │ ├── UnimplementedFeatureError.as │ └── UsageError.as │ ├── events │ └── TimeoutCommandEvent.as │ ├── framework │ ├── Assert.as │ ├── Async.as │ ├── Command.as │ ├── ErrorEvent.as │ ├── IAsync.as │ ├── IResult.as │ ├── IRunListener.as │ ├── IRunner.as │ ├── IRunnerFactory.as │ ├── ITestFailure.as │ ├── ITestListener.as │ ├── ITestSuccess.as │ ├── ITestWarning.as │ ├── LegacyTestIterator.as │ ├── Method.as │ ├── Result.as │ ├── RunnerFactory.as │ ├── SuiteIterator.as │ ├── TestCase.as │ ├── TestFailure.as │ ├── TestIterator.as │ ├── TestSuccess.as │ ├── TestWarning.as │ └── TimeoutCommand.as │ ├── printers │ ├── ColorTracePrinter.as │ ├── FlashBuilderPrinter.as │ ├── FlashDevelopPrinter.as │ ├── FlexUnitCIPrinter.as │ ├── TextPrinter.as │ └── XMLPrinter.as │ ├── runners │ ├── LegacyRunner.as │ ├── SuiteRunner.as │ └── TestRunner.as │ └── util │ ├── ArrayIterator.as │ └── Iterator.as ├── test ├── AllTests.as ├── AsUnitCIRunner.as ├── AsUnitRunner.as ├── AsUnitRunnerCS3.fla ├── Flex3Runner.mxml ├── Flex4Runner.mxml └── asunit │ ├── core │ └── AsUnitCoreTest.as │ ├── framework │ ├── AssertEqualsArraysIgnoringOrderTest.as │ ├── AssertEqualsArraysTest.as │ ├── AssertTest.as │ ├── AssertThrowsTest.as │ ├── AssertThrowsWithMessageTest.as │ ├── AsyncMethodTest.as │ ├── AsyncTest.as │ ├── MockData.xml │ ├── NestedSuiteIteratorTest.as │ ├── ProceedOnEventTest.as │ ├── ResultObserverTest.as │ ├── ResultTest.as │ ├── RunnerFactoryTest.as │ ├── SuiteIteratorTest.as │ ├── TestCaseMock.as │ ├── TestIteratorIgnoredMethodTest.as │ ├── TestIteratorMethodByNameTest.as │ ├── TestIteratorMultiMethodTest.as │ ├── TestIteratorOrderedTestMethodTest.as │ ├── TestIteratorSingleMethodTest.as │ ├── VisualTestCaseTest.as │ └── assertAssertionFailed.as │ ├── printers │ ├── ColorTracePrinterTest.as │ ├── FlashBuilderPrinterTest.as │ ├── TextPrinterTest.as │ └── XMLPrinterTest.as │ ├── runners │ ├── LegacyRunnerTest.as │ ├── SuiteRunnerTest.as │ ├── TestRunnerAsyncMethodTest.as │ ├── TestRunnerErrorMethodTest.as │ ├── TestRunnerExpectsErrorTest.as │ ├── TestRunnerExpectsErrorWithMessageTest.as │ ├── TestRunnerIgnoredMethodTest.as │ └── TestRunnerTest.as │ ├── support │ ├── CustomParameters.as │ ├── CustomSuiteRunner.as │ ├── DoubleFailSuite.as │ ├── DoubleNestedSuite.as │ ├── ErrorInMethod.as │ ├── FailAssertEquals.as │ ├── FailAssertTrue.as │ ├── FakeObserver.as │ ├── IgnoredMethod.as │ ├── InjectionFailure.as │ ├── InjectionVerification.as │ ├── LegacyTestCase.as │ ├── MultiMethod.as │ ├── OrderedTestMethod.as │ ├── RunWithButNoType.as │ ├── RunWithSuiteButNoType.as │ ├── SingleErrorSuite.as │ ├── SingleSuccessSuite.as │ ├── SucceedAssertTrue.as │ ├── SuiteOfTwoSuites.as │ ├── SuiteWithCustomRunner.as │ └── SuiteWithOneCustomChildSuite.as │ └── util │ └── ArrayIteratorTest.as └── vendor ├── as3injection └── org │ └── swiftsuspenders │ ├── InjectionConfig.as │ ├── InjectionType.as │ ├── Injector.as │ ├── InjectorError.as │ ├── Reflector.as │ ├── getConstructor.as │ ├── injectionpoints │ ├── ConstructorInjectionPoint.as │ ├── InjectionPoint.as │ ├── MethodInjectionPoint.as │ ├── NoParamsConstructorInjectionPoint.as │ ├── PostConstructInjectionPoint.as │ └── PropertyInjectionPoint.as │ └── injectionresults │ ├── InjectClassResult.as │ ├── InjectOtherRuleResult.as │ ├── InjectSingletonResult.as │ ├── InjectValueResult.as │ └── InjectionResult.as ├── as3reflection ├── README └── p2 │ └── reflect │ ├── Reflection.as │ ├── ReflectionAccessor.as │ ├── ReflectionBase.as │ ├── ReflectionMember.as │ ├── ReflectionMetaData.as │ ├── ReflectionMethod.as │ ├── ReflectionMethodParameter.as │ ├── ReflectionVariable.as │ └── findFirst.as └── generators └── suite ├── USAGE ├── suite_generator.rb └── templates └── TestSuite.as /.gitignore: -------------------------------------------------------------------------------- 1 | asunit-2.0/bin 2 | asunit-2.5/bin 3 | asunit-3.0/bin 4 | asunit-3.0/bin-debug 5 | asunit-3.0/obj 6 | asunit-4.0/bin 7 | asunit-4.0/bin-debug 8 | asunit-4.0/obj 9 | asunit-4.0/report 10 | html-template 11 | .DS_Store 12 | .actionScriptProperties 13 | .flexProperties 14 | .settings 15 | .project 16 | *~ 17 | -------------------------------------------------------------------------------- /MIT-LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2004-2009 Ali Mills and Luke Bayes 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /README.textile: -------------------------------------------------------------------------------- 1 | 2 | h1. AsUnit is the only unit test framework that supports Flash Players 6, 7, 8, 9, 10, Flash Lite, Flex and Adobe AIR 3 | 4 | AsUnit is compatible with any ActionScript compiler, runtime or IDE. This includes MTASC, Flash MX, Flash MX 2004, Flash 8, Flash CS3, Flash CS4, Flex Builder 1.5, Flex Builder 2.0, Flex Builder 3.0, Flash Lite 1.0, Flash Lite 2.0, and even Adobe AIR. 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /asunit-2.0/MIT-LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /asunit-2.0/README.textile: -------------------------------------------------------------------------------- 1 | 2 | h1. AsUnit 2 3 | 4 | This build of the AsUnit framework is intended to work with ActionScript 2 as it appeared in Flash Player 6. 5 | 6 | ActionScript 2 was quickly improved for Flash Players 7, 8 and Flash Lite 2.0, and if you're developing for those platforms, please use the as25 branch found nearby, as that framework is much more robust and mature. 7 | 8 | -------------------------------------------------------------------------------- /asunit-2.0/src/com/asunit/controls/LocalOutputPanelTextAreaTest.as: -------------------------------------------------------------------------------- 1 | 2 | import com.asunit.controls.*; 3 | import com.asunit.framework.*; 4 | 5 | class LocalOutputPanelTextAreaTest extends TestCase { 6 | private var className:String = "com.asunit.controls.LocalOutputPanelTextAreaTest"; 7 | private var testInstance:LocalOutputPanelTextArea; 8 | 9 | public function setUp():Void { 10 | var dpth:Number = getValidDepth(_root); 11 | testInstance = LocalOutputPanelTextArea(_root.attachMovie(LocalOutputPanelTextArea.linkageId, "textArea_" + dpth, dpth)); 12 | } 13 | 14 | public function tearDown():Void { 15 | testInstance.removeMovieClip(); 16 | } 17 | 18 | public function testInstantiated():Void { 19 | assertTrue("LocalOutputPanelTextArea instantiated", testInstance instanceof LocalOutputPanelTextArea); 20 | } 21 | 22 | public function testMessage():Void { 23 | testInstance.text = "hello world"; 24 | assertTrue("text retrieves", (testInstance.text == "hello world")); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /asunit-2.0/src/com/asunit/controls/ResizeHandle.as: -------------------------------------------------------------------------------- 1 | 2 | import com.asunit.controls.*; 3 | import com.asunit.controls.shapes.*; 4 | 5 | class com.asunit.controls.ResizeHandle extends Rectangle { 6 | public static var linkageId:String = "__Packages.com.asunit.controls.ResizeHandle"; 7 | public static var classRef:Function = ResizeHandle; 8 | private var bgColor:Number = 0xCCCCCC; 9 | private var controller:Object; 10 | 11 | public function ResizeHandle() { 12 | onPress = doPress; 13 | onRelease = doRelease; 14 | onReleaseOutside = doReleaseOutside; 15 | } 16 | 17 | public function doPress():Void { 18 | onMouseMove = doMouseMove; 19 | } 20 | 21 | public function doReleaseOutside():Void { 22 | onRelease(); 23 | } 24 | 25 | public function doMouseMove():Void { 26 | controller.onResizeHandleMoved(); 27 | updateAfterEvent(); 28 | } 29 | 30 | public function doRelease():Void { 31 | delete onMouseMove; 32 | } 33 | 34 | public static var serializable:Boolean = Object.registerClass(linkageId, classRef); 35 | } -------------------------------------------------------------------------------- /asunit-2.0/src/com/asunit/controls/ScrollArrow.as: -------------------------------------------------------------------------------- 1 | 2 | import com.asunit.controls.*; 3 | import com.asunit.controls.shapes.*; 4 | 5 | class com.asunit.controls.ScrollArrow extends Rectangle { 6 | public static var linkageId:String = "__Packages.com.asunit.controls.ScrollArrow"; 7 | public static var classRef:Function = ScrollArrow; 8 | private var controller:TextScroller; 9 | private var bgColor:Number = 0xCCCCCC; 10 | 11 | public function ScrollArrow() { 12 | init(); 13 | } 14 | 15 | public function init():Void { 16 | onPress = doPress; 17 | onRelease = doRelease; 18 | onReleaseOutside = doReleaseOutside; 19 | } 20 | 21 | public function doPress():Void { 22 | controller.onArrowPressed(this); 23 | } 24 | 25 | public function doReleaseOutside():Void { 26 | onRelease(); 27 | } 28 | 29 | public function doRelease():Void { 30 | controller.onArrowReleased(this); 31 | } 32 | 33 | public static var serializable:Boolean = Object.registerClass(linkageId, classRef); 34 | } -------------------------------------------------------------------------------- /asunit-2.0/src/com/asunit/controls/ScrollHandle.as: -------------------------------------------------------------------------------- 1 | 2 | import com.asunit.controls.*; 3 | import com.asunit.controls.shapes.*; 4 | 5 | class com.asunit.controls.ScrollHandle extends Rectangle { 6 | public static var linkageId:String = "__Packages.com.asunit.controls.ScrollHandle"; 7 | public static var classRef:Function = ScrollHandle; 8 | private var controller:TextScroller; 9 | private var bgColor:Number = 0xCCCCCC; 10 | 11 | public function ScrollHandle() { 12 | init(); 13 | } 14 | 15 | public function init():Void { 16 | onPress = doPress; 17 | onRelease = doRelease; 18 | onReleaseOutside = doReleaseOutside; 19 | } 20 | 21 | public function doPress():Void { 22 | onMouseMove = doMouseMove; 23 | controller.onScrollHandlePressed(); 24 | startDrag(this, false, 0, _parent.upArrow._y, 0, _parent.getHandleTravel()); 25 | } 26 | 27 | public function doReleaseOutside():Void { 28 | onRelease(); 29 | } 30 | 31 | public function doMouseMove():Void { 32 | controller.onScrollHandleMoved(); 33 | updateAfterEvent(); 34 | } 35 | 36 | public function doRelease():Void { 37 | stopDrag(); 38 | controller.onScrollHandleReleased(); 39 | delete onMouseMove; 40 | } 41 | 42 | public static var serializable:Boolean = Object.registerClass(linkageId, classRef); 43 | } -------------------------------------------------------------------------------- /asunit-2.0/src/com/asunit/controls/ScrollListener.as: -------------------------------------------------------------------------------- 1 | 2 | import com.asunit.controls.*; 3 | import com.asunit.util.*; 4 | 5 | interface com.asunit.controls.ScrollListener extends Observable { 6 | 7 | public function onScrollUp(event:Object):Void; 8 | public function onScrollDown(event:Object):Void; 9 | public function getTextField():TextField; 10 | } 11 | -------------------------------------------------------------------------------- /asunit-2.0/src/com/asunit/controls/shapes/Rectangle.as: -------------------------------------------------------------------------------- 1 | 2 | import com.asunit.controls.shapes.*; 3 | 4 | class com.asunit.controls.shapes.Rectangle extends MovieClip { 5 | private var strokeSize:Number = 0; 6 | private var bgColor:Number = 0xEEEEEE; 7 | private var borderColor:Number = 0x666666; 8 | public var width:Number; 9 | public var height:Number; 10 | 11 | public function Rectangle() { 12 | } 13 | 14 | public function onLoad():Void { 15 | refreshLayout(); 16 | } 17 | 18 | public function refreshLayout():Void { 19 | clear(); 20 | lineStyle(strokeSize, borderColor, 100); 21 | beginFill(bgColor, 100); 22 | moveTo(0, 0); 23 | lineTo(width, 0); 24 | lineTo(width, height); 25 | lineTo(0, height); 26 | lineTo(0, 0); 27 | } 28 | 29 | } -------------------------------------------------------------------------------- /asunit-2.0/src/com/asunit/controls/shapes/Triangle.as: -------------------------------------------------------------------------------- 1 | 2 | import com.asunit.controls.shapes.*; 3 | 4 | class com.asunit.controls.shapes.Triangle extends MovieClip { 5 | private var strokeSize:Number = 0; 6 | private var bgColor:Number = 0xCCCCCC; 7 | private var borderColor:Number = 0x666666; 8 | private var width:Number; 9 | private var height:Number; 10 | 11 | public function Triangle() { 12 | } 13 | 14 | public function onLoad():Void { 15 | refreshLayout(); 16 | } 17 | 18 | public function refreshLayout():Void { 19 | clear(); 20 | lineStyle(strokeSize, borderColor, 100); 21 | beginFill(bgColor, 100); 22 | moveTo(0, 0); 23 | lineTo(width, 0); 24 | lineTo(width/2, height); 25 | lineTo(0,0); 26 | } 27 | } -------------------------------------------------------------------------------- /asunit-2.0/src/com/asunit/framework/AsUnit.as: -------------------------------------------------------------------------------- 1 | 2 | import com.asunit.framework.*; 3 | 4 | class com.asunit.framework.AsUnit extends TestSuite { 5 | private var className:String = "asunit.framework.AsUnit"; 6 | private var output:Sys; 7 | private var testCase:TestCase; 8 | private var testSuite:TestSuite; 9 | 10 | public function AsUnit() { 11 | init(); 12 | } 13 | 14 | private function init():Void { 15 | testSuite = new TestSuite(); 16 | testCase = new TestCase(); 17 | } 18 | 19 | } -------------------------------------------------------------------------------- /asunit-2.0/src/com/asunit/framework/Assertion.as: -------------------------------------------------------------------------------- 1 | 2 | class com.asunit.framework.Assertion { 3 | private var className:String; 4 | private var methodName:String; 5 | private var message:String; 6 | private var assertion:String; 7 | private var passed:Boolean; 8 | 9 | private function Assertion(cName:String, mName:String, msg:String, assert:String) 10 | { 11 | className = cName; 12 | methodName = mName; 13 | message = msg; 14 | assertion = assert; 15 | } 16 | 17 | public function toString():String 18 | { 19 | var str:String = ""; 20 | for(var i:String in this) { 21 | if(!(this[i] instanceof Function)) { 22 | str += i + " : " + this[i] + "\n"; 23 | } 24 | } 25 | return str; 26 | } 27 | } -------------------------------------------------------------------------------- /asunit-2.0/src/com/asunit/framework/Reflection.as: -------------------------------------------------------------------------------- 1 | 2 | import com.asunit.framework.*; 3 | 4 | class com.asunit.framework.Reflection { 5 | private var visitedObjects:Array; 6 | private var qualifiedName:String; 7 | 8 | public static function getQualifiedName(ref:Object) 9 | { 10 | return new Reflection(ref).toString(); 11 | } 12 | 13 | // Use static Constructor / getQualifiedName 14 | private function Reflection(ref:Object) 15 | { 16 | visitedObjects = new Array(); 17 | qualifiedName = getNameSpace("", _global, ref); 18 | } 19 | 20 | public function toString() 21 | { 22 | return qualifiedName; 23 | } 24 | 25 | public function beenVisited(obj:Object):Boolean 26 | { 27 | for(var i in visitedObjects) { 28 | if(visitedObjects[i] == obj) { 29 | return true; 30 | } 31 | } 32 | return false; 33 | } 34 | 35 | public function openMember(ref:Object) 36 | { 37 | _global.ASSetPropFlags(ref, null, 6, true); 38 | } 39 | 40 | public function closeMember(ref:Object) 41 | { 42 | _global.ASSetPropFlags(ref, null, 0, true); 43 | } 44 | 45 | public function getNameSpace(name:String, ref:Object, obj:Object) 46 | { 47 | if(!beenVisited(ref)) { 48 | var str = name; 49 | openMember(ref); 50 | visitedObjects.push(ref); 51 | for(var i in ref) { 52 | if(i == "prototype" || i == "__proto__" || i == "toLocaleString" || i == "constructor") { 53 | continue; 54 | } 55 | str += ((str == "") ? "" :".") + i; 56 | if(ref[i] == obj) { 57 | closeMember(ref); 58 | return str; 59 | } 60 | closeMember(ref); 61 | // check here so that looping continues if result is invalid... 62 | return getNameSpace(str, ref[i], obj); 63 | } 64 | closeMember(ref); 65 | return str; 66 | } 67 | } 68 | } -------------------------------------------------------------------------------- /asunit-2.0/src/com/asunit/framework/Test.as: -------------------------------------------------------------------------------- 1 | 2 | interface com.asunit.framework.Test { 3 | } 4 | -------------------------------------------------------------------------------- /asunit-2.0/src/com/asunit/framework/TestCaseXml.as: -------------------------------------------------------------------------------- 1 | 2 | import com.asunit.framework.*; 3 | 4 | class com.asunit.framework.TestCaseXml extends XML { 5 | 6 | public static var linkageId:String = "com.asunit.framework.TestCaseXml"; 7 | public static var classRef:Function = TestCaseXml; 8 | 9 | private var source:String; 10 | private var callback:TestCase; 11 | 12 | public function TestCaseXml(src:String, cb:TestCase) { 13 | source = src; 14 | callback = cb; 15 | ignoreWhite = true; 16 | onLoad = doLoad; 17 | if(src != undefined) { 18 | load(source); 19 | } 20 | } 21 | 22 | public function doLoad(success:Boolean):Void { 23 | if(success) { 24 | callback.onXmlLoaded(this.firstChild); 25 | } else { 26 | Sys.println(">> there was an error loading XML at : " + source); 27 | } 28 | } 29 | 30 | public static var serializable:Boolean = Object.registerClass(linkageId, classRef); 31 | } 32 | -------------------------------------------------------------------------------- /asunit-2.0/src/com/asunit/framework/TestFailure.as: -------------------------------------------------------------------------------- 1 | 2 | import com.asunit.framework.*; 3 | 4 | class com.asunit.framework.TestFailure extends Assertion implements Test { 5 | 6 | public var output:String = "F"; 7 | public var success:Boolean = false; 8 | 9 | public function TestFailure(cName:String, mName:String, msg:String, assertion:String) 10 | { 11 | super(cName, mName, msg, assertion); 12 | output = "F"; 13 | success = false; 14 | } 15 | } -------------------------------------------------------------------------------- /asunit-2.0/src/com/asunit/framework/TestResult.as: -------------------------------------------------------------------------------- 1 | 2 | import com.asunit.framework.*; 3 | 4 | class com.asunit.framework.TestResult extends Assertion implements Test { 5 | 6 | public var output:String; 7 | public var success:Boolean; 8 | 9 | public function TestResult(cName:String, mName:String, msg:String, assertion:String) 10 | { 11 | super(cName, mName, msg, assertion); 12 | output = "."; 13 | success = true; 14 | } 15 | } -------------------------------------------------------------------------------- /asunit-2.0/src/com/asunit/framework/TestRunner.as: -------------------------------------------------------------------------------- 1 | 2 | import com.asunit.framework.*; 3 | import com.asunit.util.*; 4 | 5 | class com.asunit.framework.TestRunner extends Array { 6 | public static var localConn:LocalConnClient; 7 | private var intervalId:Number; 8 | private var interval:Number = 10; 9 | private var tests:Array; 10 | 11 | private static function getLocalConn():LocalConnClient { 12 | if(localConn == null) { 13 | localConn = LocalConnGateway.createClient("_AsUnitTestRunner"); 14 | localConn["clearTestDisplay"](); 15 | } 16 | return localConn; 17 | } 18 | 19 | public function TestRunner() { 20 | tests = new Array(); 21 | } 22 | 23 | public function push(item:Object):Number { 24 | var num:Number = tests.push(item); 25 | clearInterval(intervalId); 26 | 27 | if(num > 100) { 28 | renderTests(); 29 | } else { 30 | intervalId = setInterval(this, "renderTests", interval); 31 | } 32 | return num; 33 | } 34 | 35 | public function renderTests():Void { 36 | clearInterval(intervalId); 37 | var lc:LocalConnClient = getLocalConn(); 38 | lc["addTests"](tests); 39 | tests = new Array(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /asunit-2.0/src/com/asunit/framework/TestSetup.as: -------------------------------------------------------------------------------- 1 | 2 | import com.asunit.framework.*; 3 | 4 | class com.asunit.framework.TestSetup extends TestCase { 5 | 6 | private function runMethod(method:String):Void { 7 | setCurrentMethod(method); 8 | this[method](); 9 | } 10 | 11 | private function run():Void { 12 | var mList:Array = getMethods(); 13 | setUp(); 14 | for(var i:Number=0; i> EventListener constructor may cause problems because Function reference passed without appropriate scope argument."); 12 | } 13 | source = src; 14 | scope = scp; 15 | event = (evnt == undefined || evnt == null) ? EventListener.defaultEvent : evnt; 16 | } 17 | 18 | public function getScope():Object { 19 | return scope; 20 | } 21 | 22 | public function getSource():Object { 23 | return source; 24 | } 25 | 26 | public function getEvent():String { 27 | return event; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /asunit-2.0/src/com/asunit/util/LocalConnClient.as: -------------------------------------------------------------------------------- 1 | 2 | import com.asunit.util.*; 3 | 4 | dynamic class com.asunit.util.LocalConnClient extends LocalConnection { 5 | 6 | public var serverId:String; 7 | 8 | public function LocalConnClient(srvrId:String) { 9 | init(srvrId); 10 | } 11 | 12 | private function init(srvrId:String):Void { 13 | serverId = srvrId; 14 | } 15 | 16 | public function __resolve(fname:String):Function { 17 | // Execute Any Method Call thru gateway on Server and return results... 18 | var ref:LocalConnClient = this; 19 | return Function( function() { 20 | arguments.unshift(fname); 21 | arguments.unshift("execResolve"); 22 | arguments.unshift( ref.serverId); 23 | return ref.execMethod.apply(this, arguments); 24 | }); 25 | } 26 | 27 | public function execMethod():Object { 28 | //send.apply(this, arguments); 29 | return send.apply(this, arguments); 30 | } 31 | 32 | public function onStatus(infoObject:Object):Void { 33 | // trace("!! Client Local Connection Object.onStatus Called with : "); 34 | // for(var i in arguments) { 35 | // trace(i + " : " + arguments[i]); 36 | // for(var k in arguments[i]) { 37 | // trace(i + "." + k + " : "+ arguments[i][k]); 38 | // } 39 | // } 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /asunit-2.0/src/com/asunit/util/LocalConnGateway.as: -------------------------------------------------------------------------------- 1 | 2 | import com.asunit.util.*; 3 | 4 | /************************************************ 5 | ::: LocalConnGateway 6 | 7 | SERVER EXAMPLE: 8 | var dp = new RemoteApiClass(); // Like DataProviderClass(); 9 | var srvrId = "SomeUniqueIdentifier"; 10 | this.local = com.framework.util.LocalConnGateway.createServer(dp, srvrId); 11 | 12 | CLIENT EXAMPLE: 13 | var srvrId = "SomeUniqueIdentifier"; // matches an existing serverId 14 | this.remote = com.framework.util.LocalConnGateway.createClient(srvrId); 15 | 16 | this.res = this.remote.getItemAt(3); 17 | echo("res : " + this.res.label); 18 | 19 | ************************************************/ 20 | 21 | class com.asunit.util.LocalConnGateway { 22 | //private static var existingServers:Array; 23 | //private static var clientQueue:Array; 24 | 25 | //------------------------------------------------ 26 | // Factory method for LC Server Instances 27 | // cb : An Object Instance that whose methods/props will be called 28 | // by any client classes 29 | // srvrId : Unique string to identify the LC Server instance 30 | // NOTE: Any "." found in the serverId will be ripped out... 31 | // this is done to prevent any potential namespace conflicts... 32 | public static function createServer(cb:Object, srvrId:String):LocalConnServer 33 | { 34 | return new LocalConnServer(cb, srvrId); 35 | } 36 | 37 | //------------------------------------------------ 38 | // Factory method for LC Client Instances 39 | // srvrId : Unique String Matching an existing .createServer instance 40 | public static function createClient(srvrId:String):LocalConnClient 41 | { 42 | return new LocalConnClient(srvrId); 43 | // was attempting to build a queue so that clients could be created 44 | // before servers - but *I think* that they already can!!! 45 | //return getClient(validateId(srvrId)); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /asunit-2.0/src/com/asunit/util/LocalConnServer.as: -------------------------------------------------------------------------------- 1 | 2 | dynamic class com.asunit.util.LocalConnServer extends LocalConnection { 3 | 4 | private var controller:Object; 5 | private var id:String; 6 | public var status:Boolean; 7 | 8 | public function LocalConnServer(ctrl:Object, srvrId:String) { 9 | init(ctrl, srvrId); 10 | } 11 | 12 | private function init(ctrl:Object, srvrId:String):Void { 13 | controller = ctrl; 14 | id = srvrId; 15 | status = connect(srvrId); 16 | } 17 | 18 | public function getId():String { 19 | return id; 20 | } 21 | 22 | public function close():Void { 23 | //trace(">> LocalConnServer Closing now from : " + id); 24 | super.close(); 25 | } 26 | 27 | public function connect(str:String):Boolean { 28 | if(super.connect(str)) { 29 | return true; 30 | } else { 31 | trace("!! CONNECT CALL FAILED IN createServer with : " + getId()); 32 | return false; 33 | } 34 | } 35 | 36 | public function allowDomain(domain:String):Boolean { 37 | // EXTREMELY INSECURE... 38 | return true; 39 | } 40 | 41 | public function allowInsecureDomain(domain:String):Boolean { 42 | return true; 43 | } 44 | 45 | // Used for synchronous communication... 46 | public function execResolve_sync(method:String):Object { 47 | arguments.shift(); 48 | return controller[method].apply(controller, arguments); 49 | } 50 | 51 | // Used for asynchronous communication... 52 | public function execResolve( method:String):Void { 53 | // trace(">> exec resolve called from the window swf with : " + arguments); 54 | arguments.shift(); 55 | controller[method].apply(controller, arguments); 56 | } 57 | 58 | public function onStatus(infoObject:Object):Void { 59 | trace("!! Server LocalConnonStatus Called with : " + arguments + " id : " + getId()); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /asunit-2.0/src/com/asunit/util/LocalMessageBroker.as: -------------------------------------------------------------------------------- 1 | 2 | import com.asunit.util.*; 3 | 4 | class com.asunit.util.LocalMessageBroker extends Object implements Observable { 5 | private static var instance:LocalMessageBroker; 6 | private var msgs:Array; 7 | private var eventSrc:EventSource; 8 | 9 | private function LocalMessageBroker() { 10 | init(); 11 | } 12 | 13 | private function init():Void { 14 | msgs = new Array(); 15 | eventSrc = new EventSource(); 16 | } 17 | 18 | public static function getInstance():LocalMessageBroker { 19 | if(instance == undefined) { 20 | instance = new LocalMessageBroker(); 21 | } 22 | return instance; 23 | } 24 | 25 | public function send(msg:String, category:String):String { 26 | msgs.push({message:msg, category:category}); 27 | eventSrc.broadcastMessage("onMessageSent", {event:"onMessageSent", message:msg, category:category}); 28 | return msg; 29 | } 30 | 31 | public function toString():String { 32 | var str:String = ""; 33 | for(var i:Number = 0; i < msgs.length; i++) { 34 | str += msgs[i] + "\n"; 35 | } 36 | return str; 37 | } 38 | 39 | // Can accept either an event:String or an event:String[] 40 | // if the observer wants to subscribe to multiple events. 41 | public function addEventListener(event:String, observer:Object, scope:Object):Void { 42 | eventSrc.addEventListener(event, observer, scope); 43 | } 44 | 45 | public function addListener(observer:Object, scope:Object):Void { 46 | eventSrc.addListener(observer, scope); 47 | } 48 | 49 | // Should return bool false if handler ref was not found. 50 | // Should return bool true if handler ref was found 51 | public function removeEventListener(event:String, observer:Object):Boolean { 52 | return eventSrc.removeEventListener(event, observer); 53 | } 54 | 55 | public function removeListener(observer:Object):Boolean { 56 | return eventSrc.removeListener(observer); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /asunit-2.0/src/com/asunit/util/Observable.as: -------------------------------------------------------------------------------- 1 | 2 | interface com.asunit.util.Observable { 3 | // Can accept either an event:String or an event:String[] 4 | // if the observer wants to subscribe to multiple events. 5 | public function addEventListener(event:String, observer:Object, scope:Object):Void; 6 | public function addListener(observer:Object, scope:Object):Void; 7 | // Should return bool false if handler ref was not found. 8 | // Should return bool true if handler ref was found 9 | public function removeEventListener(event:String, observer:Object):Boolean; 10 | public function removeListener(observer:Object):Boolean; 11 | } 12 | -------------------------------------------------------------------------------- /asunit-2.0/src/com/asunit/util/TextFile.as: -------------------------------------------------------------------------------- 1 | 2 | class com.asunit.util.TextFile extends XML { 3 | public static var linkageId:String = "com.asunit.util.TextFile"; 4 | public static var classRef:Function = TextFile; 5 | 6 | private var source:String; 7 | private var callback:Object; 8 | private var fileString:String; 9 | 10 | public function TextFile(src:String, cb:Object) { 11 | source = src; 12 | callback = cb; 13 | ignoreWhite = true; 14 | onData = doData; 15 | if(src != undefined) { 16 | load(source); 17 | } 18 | } 19 | 20 | public function doData(str:String):Void { 21 | fileString = str; 22 | callback.onTextFileLoaded(this); 23 | } 24 | 25 | public function toString():String { 26 | return fileString; 27 | } 28 | 29 | public static var serializable:Boolean = Object.registerClass(linkageId, classRef); 30 | } 31 | -------------------------------------------------------------------------------- /asunit-2.5/AsUnitRunner.fla: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patternpark/asunit/5bc790908714801e4fa16badd43d232b4200a60d/asunit-2.5/AsUnitRunner.fla -------------------------------------------------------------------------------- /asunit-2.5/MIT-LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /asunit-2.5/README.textile: -------------------------------------------------------------------------------- 1 | 2 | h1. AsUnit 2.x 3 | 4 | This build of the AsUnit framework is intended to work with ActionScript 2.x as it appeared in Flash Players 7 and 8. There was an earlier version of ActionScript 2 that did not support exceptions. If you plan on supporting Flash Player 6 or Flash Lite 1.0, you may need to use the as2 branch found nearby. 5 | 6 | -------------------------------------------------------------------------------- /asunit-2.5/rakefile.rb: -------------------------------------------------------------------------------- 1 | require 'sprout' 2 | sprout 'as2' 3 | 4 | ########################################## 5 | # To build from this file, install Ruby (http://ruby-lang.org) 6 | # and RubyGems (http://rubygems.org/), then run: 7 | # gem install sprout 8 | # gem install rake 9 | # rake 10 | # This should walk you through the installation 11 | # of required gems, compilers and vms 12 | 13 | ########################################## 14 | # Compile the Test Harness 15 | 16 | desc "Compile the test harness" 17 | mtasc 'bin/AsUnitRunner.swf' do |t| 18 | t.main = true 19 | t.header = '1000:600:24' 20 | t.cp << 'src' 21 | t.cp << 'test' 22 | t.input = 'test/AsUnitRunner.as' 23 | end 24 | 25 | ########################################## 26 | # Generate documentation 27 | 28 | # desc "Generate documentation" 29 | # asdoc 'doc' do |t| 30 | # t.source_path << 'src' 31 | # t.doc_classes << 'AsUnit' 32 | # end 33 | 34 | ########################################## 35 | # Launch the Test Harness 36 | 37 | desc "Compile and run the test harness" 38 | flashplayer :run => 'bin/AsUnitRunner.swf' 39 | 40 | ########################################## 41 | # Set up task wrappers 42 | 43 | task :default => :run 44 | 45 | desc "Alias to the default task" 46 | task :test => :run 47 | 48 | 49 | 50 | 51 | 52 | 53 | # def to_class_name(file) 54 | # parts = file.split('/') 55 | # parts.shift 56 | # name = parts.pop 57 | # name.split('.').shift 58 | # end 59 | # 60 | # def to_var_name(file) 61 | # parts = file.split('/') 62 | # parts.shift 63 | # name = parts.pop 64 | # name = name.split('.').shift 65 | # name[0, 1].downcase + name[1, name.size] 66 | # end 67 | # 68 | # Dir.glob('src/**/**/*').each do |file| 69 | # if(!File.directory?(file)) 70 | # puts "private var #{to_var_name file}:#{to_class_name file};" 71 | # end 72 | # end 73 | 74 | -------------------------------------------------------------------------------- /asunit-2.5/src/asunit/errors/AssertionFailedError.as: -------------------------------------------------------------------------------- 1 | class asunit.errors.AssertionFailedError extends Error { 2 | 3 | public var fqcn:String = "asunit.errors.AssertionFailedError"; 4 | 5 | public function AssertionFailedError(msg:String) { 6 | super(msg); 7 | name = "AssertionFailedError"; 8 | } 9 | } -------------------------------------------------------------------------------- /asunit-2.5/src/asunit/errors/ClassNameUndefinedError.as: -------------------------------------------------------------------------------- 1 | class asunit.errors.ClassNameUndefinedError extends Error { 2 | 3 | public var fqcn:String = "ClassNameUndefinedError"; 4 | public function ClassNameUndefinedError(message : String){ super(message); 5 | name = "ClassNameUndefinedError"; } 6 | } -------------------------------------------------------------------------------- /asunit-2.5/src/asunit/errors/ClassNotFoundError.as: -------------------------------------------------------------------------------- 1 | class asunit.errors.ClassNotFoundError extends Error { 2 | 3 | public var fqcn:String = "asunit.errors.ClassNotFoundError"; 4 | 5 | public function ClassNotFoundError(msg:String) { 6 | super(msg); 7 | name = "ClassNotFoundError"; 8 | } 9 | } -------------------------------------------------------------------------------- /asunit-2.5/src/asunit/errors/InstanceNotFoundError.as: -------------------------------------------------------------------------------- 1 | class asunit.errors.InstanceNotFoundError extends Error { 2 | 3 | public var fqcn:String = "asunit.errors.InstanceNotFoundError"; 4 | 5 | public function InstanceNotFoundError(msg:String) { 6 | super(msg); 7 | name = "InstanceNotFoundError"; 8 | } 9 | } -------------------------------------------------------------------------------- /asunit-2.5/src/asunit/errors/UnimplementedFeatureError.as: -------------------------------------------------------------------------------- 1 | class asunit.errors.UnimplementedFeatureError extends Error { 2 | 3 | public var fqcn:String = "asunit.errors.UnimplementedFeatureError"; 4 | 5 | public function UnimplementedFeatureError(msg:String) { 6 | super(msg); 7 | name = "UnimplementedFeatureError"; 8 | } 9 | } -------------------------------------------------------------------------------- /asunit-2.5/src/asunit/flash/errors/IllegalOperationError.as: -------------------------------------------------------------------------------- 1 | class asunit.flash.errors.IllegalOperationError extends Error { public var fqcn:String = "asunit.flash.errors.IllegalOperationError"; public function IllegalOperationError(message : String) { super(message); name = "IllegalOperationError"; } 2 | } -------------------------------------------------------------------------------- /asunit-2.5/src/asunit/flash/events/Event.as: -------------------------------------------------------------------------------- 1 | class asunit.flash.events.Event { public static var COMPLETE:String = "complete"; public static var CHANGE:String = "change"; private var _type:String; private var _target:Object; public function Event(type:String, target:Object) { _type = type; _target = target==undefined ? null : target; } public function get type():String{ return _type; } } -------------------------------------------------------------------------------- /asunit-2.5/src/asunit/flash/events/EventDispatcher.as: -------------------------------------------------------------------------------- 1 | import asunit.util.ArrayUtil; import asunit.flash.events.Event; import asunit.flash.events.IEventDispatcher; 2 | /* * Minimal implementation of AS3 flash.events.EventDispatcher as required by asunit3 */ 3 | class asunit.flash.events.EventDispatcher implements IEventDispatcher{ private var listeners:Object; public function EventDispatcher() { listeners = {}; } 4 | public function addEventListener(type:String, listener:Function, scope:Object):Void { var l:Object = {s:scope, c:listener}; if(listeners[type] instanceof Array){ listeners[type].push(l); }else{ listeners[type] = [l]; } } public function dispatchEvent(event : Event) : Void { if(listeners[event.type] instanceof Array){ ArrayUtil.forEach(listeners[event.type], function(listener:Object):Void{ var callback:Function = listener.c; var scope:Object = listener.s; callback.call(scope, event); } ); } 5 | } } -------------------------------------------------------------------------------- /asunit-2.5/src/asunit/flash/events/IEventDispatcher.as: -------------------------------------------------------------------------------- 1 | import asunit.flash.events.Event; interface asunit.flash.events.IEventDispatcher { public function addEventListener(type:String, listener:Function, scope:Object):Void; public function dispatchEvent(event:Event):Void; } -------------------------------------------------------------------------------- /asunit-2.5/src/asunit/flash/events/TimerEvent.as: -------------------------------------------------------------------------------- 1 | import asunit.flash.events.Event; 2 | 3 | class asunit.flash.events.TimerEvent extends Event { 4 | 5 | public static var TIMER_COMPLETE:String = "timerComplete"; 6 | 7 | public function TimerEvent(type:String, target:Object) { 8 | super(type, target); 9 | } 10 | 11 | 12 | } -------------------------------------------------------------------------------- /asunit-2.5/src/asunit/framework/AsyncOperation.as: -------------------------------------------------------------------------------- 1 | import asunit.errors.AssertionFailedError; 2 | import asunit.flash.errors.IllegalOperationError; 3 | import asunit.flash.events.TimerEvent; 4 | import asunit.flash.utils.Timer; 5 | import asunit.framework.TestCase; 6 | 7 | class asunit.framework.AsyncOperation{ 8 | 9 | private var timeout:Timer; 10 | private var testCase:TestCase; 11 | private var callback:Function; 12 | private var duration:Number; 13 | 14 | public function AsyncOperation(testCase:TestCase, handler:Function, duration:Number){ 15 | this.testCase = testCase; 16 | this.duration = duration; 17 | timeout = new Timer(duration, 1); 18 | timeout.addEventListener(TimerEvent.TIMER_COMPLETE, onTimeoutComplete, this); 19 | timeout.start(); 20 | if(handler == null) { 21 | handler = function():Void{}; 22 | } 23 | var context:AsyncOperation = this; 24 | callback = function():Void{ 25 | context.timeout.stop(); 26 | try { 27 | handler.apply(testCase, arguments); 28 | } 29 | catch(e:AssertionFailedError) { 30 | testCase.getResult().addFailure(testCase, e); 31 | } 32 | catch(ioe:IllegalOperationError) { 33 | testCase.getResult().addError(testCase, ioe); 34 | } 35 | finally { 36 | testCase.asyncOperationComplete(context); 37 | } 38 | }; 39 | } 40 | 41 | public function getCallback():Function{ 42 | return callback; 43 | } 44 | 45 | private function onTimeoutComplete(event:TimerEvent):Void{ 46 | testCase.asyncOperationTimeout(this, duration); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /asunit-2.5/src/asunit/framework/ITestListener.as: -------------------------------------------------------------------------------- 1 | import asunit.errors.AssertionFailedError; 2 | import asunit.framework.Test; 3 | 4 | interface asunit.framework.ITestListener { 5 | // A test started. 6 | public function startTest(test:Test):Void; 7 | // An error occurred. 8 | public function addError(test:Test, e:Error):Void; 9 | // A failure occurred. 10 | public function addFailure(test:Test, e:AssertionFailedError):Void; 11 | // A test ended. 12 | public function endTest(test:Test):Void; 13 | } 14 | -------------------------------------------------------------------------------- /asunit-2.5/src/asunit/framework/Test.as: -------------------------------------------------------------------------------- 1 | import asunit.framework.TestListener; 2 | 3 | import asunit.flash.events.IEventDispatcher; 4 | 5 | interface asunit.framework.Test extends IEventDispatcher{ 6 | function countTestCases():Number; 7 | function getName():String; 8 | function getTestMethods():Array; 9 | function toString():String; 10 | function setResult(result : TestListener) : Void; 11 | function run():Void; 12 | function runBare():Void; 13 | function getCurrentMethod():String; 14 | function getIsComplete():Boolean; 15 | function setContext(context:MovieClip):Void; 16 | function getContext():MovieClip; 17 | } -------------------------------------------------------------------------------- /asunit-2.5/src/asunit/framework/TestCaseMock.as: -------------------------------------------------------------------------------- 1 | 2 | class asunit.framework.TestCaseMock extends MovieClip { 3 | public static var linkageId:String = "__Packages.asunit.framework.TestCaseMock"; 4 | public static var classRef:Function = TestCaseMock; 5 | 6 | public function TestCaseMock() { 7 | draw(); 8 | } 9 | 10 | public function draw():Void { 11 | var w:Number = 100; 12 | var h:Number = 100; 13 | clear(); 14 | beginFill(0xFFCC00); 15 | lineTo(w, 0); 16 | lineTo(w, h); 17 | lineTo(0, h); 18 | lineTo(0, 0); 19 | endFill(); 20 | } 21 | 22 | public static var serializable:Boolean = Object.registerClass(linkageId, classRef); 23 | } 24 | -------------------------------------------------------------------------------- /asunit-2.5/src/asunit/framework/TestFailure.as: -------------------------------------------------------------------------------- 1 | import asunit.framework.Test; 2 | import asunit.errors.AssertionFailedError; 3 | 4 | /** 5 | * A TestFailure collects a failed test together with 6 | * the caught exception. 7 | * @see TestResult 8 | */ 9 | class asunit.framework.TestFailure { 10 | private var fFailedTest:Test; 11 | private var fFailedTestMethod:String; 12 | private var fThrownException:Error; 13 | 14 | /** 15 | * Constructs a TestFailure with the given test and exception. 16 | */ 17 | public function TestFailure(failedTest:Test, thrownException:Error) { 18 | fFailedTest = failedTest; 19 | fFailedTestMethod = failedTest.getCurrentMethod(); 20 | fThrownException = thrownException; 21 | } 22 | 23 | public function failedFeature():String { 24 | return failedTest().getName() + '.' + fFailedTestMethod; 25 | } 26 | 27 | public function failedMethod():String { 28 | return fFailedTestMethod; 29 | } 30 | 31 | /** 32 | * Gets the failed test case. 33 | */ 34 | public function failedTest():Test { 35 | return fFailedTest; 36 | } 37 | /** 38 | * Gets the thrown exception. 39 | */ 40 | public function thrownException():Error { 41 | return fThrownException; 42 | } 43 | /** 44 | * Returns a short description of the failure. 45 | */ 46 | public function toString():String { 47 | return ""; 48 | } 49 | 50 | public function exceptionMessage():String { 51 | return thrownException().message; 52 | } 53 | 54 | public function isFailure():Boolean { 55 | return thrownException() instanceof AssertionFailedError; 56 | } 57 | } -------------------------------------------------------------------------------- /asunit-2.5/src/asunit/framework/TestListener.as: -------------------------------------------------------------------------------- 1 | import asunit.framework.Test; 2 | import asunit.errors.AssertionFailedError; 3 | 4 | interface asunit.framework.TestListener { 5 | 6 | /** 7 | * Run the provided Test. 8 | */ 9 | function run(test : Test) : Void; 10 | /** 11 | * A test started. 12 | */ 13 | function startTest(test:Test):Void; 14 | /** 15 | * A failure occurred. 16 | */ 17 | function addFailure(test:Test, t:AssertionFailedError):Void; 18 | /** 19 | * An error occurred. 20 | */ 21 | function addError(test:Test, t:Error):Void; 22 | /** 23 | * A test method has begun execution. 24 | */ 25 | function startTestMethod(test:Test, methodName:String):Void; 26 | /** 27 | * A test method has completed. 28 | */ 29 | function endTestMethod(test:Test, methodName:String):Void; 30 | /** 31 | * A test ended. 32 | */ 33 | function endTest(test:Test):Void; 34 | } -------------------------------------------------------------------------------- /asunit-2.5/src/asunit/framework/TestMethod.as: -------------------------------------------------------------------------------- 1 | import asunit.framework.Test; 2 | 3 | /** 4 | * A TestFailure collects a failed test together with 5 | * the caught exception. 6 | * @see TestResult 7 | */ 8 | class asunit.framework.TestMethod { 9 | private var test:Test; 10 | private var method:String; 11 | 12 | private var _duration:Number; 13 | private var start:Number; 14 | 15 | /** 16 | * Constructs a TestMethod with a given Test and method name. 17 | */ 18 | public function TestMethod(test:Test, method:String) { 19 | this.test = test; 20 | this.method = method; 21 | start = getTimer(); 22 | } 23 | 24 | public function getName():String { 25 | return method; 26 | } 27 | 28 | public function endTest(test:Test):Void { 29 | _duration = (getTimer() - start) * .001; 30 | } 31 | 32 | public function duration():Number { 33 | return _duration; 34 | } 35 | } -------------------------------------------------------------------------------- /asunit-2.5/src/asunit/runner/BaseTestRunner.as: -------------------------------------------------------------------------------- 1 | /** 2 | * Base class for all test runners. 3 | * This class was born live on stage in Sardinia during XP2000. 4 | */ 5 | class asunit.runner.BaseTestRunner extends MovieClip { 6 | 7 | // Filters stack frames from internal JUnit classes 8 | public static function getFilteredTrace(stack:String):String { 9 | return stack; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /asunit-2.5/src/asunit/runner/IResultPrinter.as: -------------------------------------------------------------------------------- 1 | import asunit.framework.ITestListener; 2 | import asunit.framework.TestResult; 3 | 4 | interface asunit.runner.IResultPrinter extends ITestListener { 5 | 6 | public function printResult(result:TestResult, runTime:Number):Void; 7 | public function traceln():Void; 8 | public function setShowTrace(showTrace:Boolean):Void; 9 | public function getShowTrace():Boolean; 10 | } -------------------------------------------------------------------------------- /asunit-2.5/src/asunit/runner/TestSuiteLoader.as: -------------------------------------------------------------------------------- 1 | interface asunit.runner.TestSuiteLoader { 2 | // throws ClassNotFoundException 3 | function load(suiteClassName:String):Function; 4 | // throws ClassNotFoundException 5 | function reload(aClass:Function):Function; 6 | } -------------------------------------------------------------------------------- /asunit-2.5/src/asunit/runner/Version.as: -------------------------------------------------------------------------------- 1 | class asunit.runner.Version { 2 | private static var version:String = "2.5.2"; 3 | 4 | public static function id():String { 5 | return version.toString(); 6 | } 7 | 8 | } -------------------------------------------------------------------------------- /asunit-2.5/src/asunit/textui/SuccessBar.as: -------------------------------------------------------------------------------- 1 | class asunit.textui.SuccessBar extends MovieClip { 2 | private var myWidth:Number; 3 | private var myHeight:Number; 4 | private var bgColor:Number; 5 | private var passingColor:Number = 0x00FF00; 6 | private var failingColor:Number = 0xFD0000; 7 | 8 | public static function create(movieClip:MovieClip):SuccessBar{ 9 | movieClip.__proto__ = SuccessBar.prototype; 10 | Function(SuccessBar).apply(movieClip); 11 | return SuccessBar(movieClip); 12 | } 13 | 14 | private function SuccessBar() { 15 | } 16 | 17 | public function setSuccess(success:Boolean):Void { 18 | bgColor = (success) ? passingColor : failingColor; 19 | draw(); 20 | } 21 | 22 | public function set width(num:Number):Void { 23 | myWidth = num; 24 | draw(); 25 | } 26 | 27 | public function set height(num:Number):Void { 28 | myHeight = num; 29 | draw(); 30 | } 31 | 32 | private function draw():Void { 33 | clear(); 34 | beginFill(bgColor); 35 | drawRect(0, 0, myWidth, myHeight); 36 | endFill(); 37 | } 38 | 39 | private function drawRect(x:Number, y:Number, width:Number, height:Number):Void{ 40 | moveTo(x,y); 41 | lineTo(x + width, y); 42 | lineTo(x + width, y + height); 43 | lineTo(x, y + height); 44 | lineTo(x,y); 45 | } 46 | } -------------------------------------------------------------------------------- /asunit-2.5/src/asunit/util/ArrayIterator.as: -------------------------------------------------------------------------------- 1 | import asunit.util.Iterator; 2 | 3 | class asunit.util.ArrayIterator implements Iterator { 4 | private var list:Array; 5 | private var index:Number = 0; 6 | 7 | public function ArrayIterator(list:Array) { 8 | this.list = list; 9 | } 10 | 11 | public function hasNext():Boolean { 12 | return list[index] != null; 13 | } 14 | 15 | public function next():Object { 16 | return list[index++]; 17 | } 18 | 19 | public function reset():Void { 20 | index = 0; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /asunit-2.5/src/asunit/util/ArrayIteratorTest.as: -------------------------------------------------------------------------------- 1 | 2 | import asunit.util.ArrayIterator; 3 | import asunit.framework.TestCase; 4 | 5 | class asunit.util.ArrayIteratorTest extends TestCase { 6 | private var className:String = "asunit.util.ArrayIteratorTest"; 7 | private var instance:ArrayIterator; 8 | 9 | public function ArrayIteratorTest(testMethod:String) { 10 | super(testMethod); 11 | } 12 | 13 | public function setUp():Void { 14 | var arr:Array = new Array("one", "two", "three", "four", "five"); 15 | instance = new ArrayIterator(arr); 16 | } 17 | 18 | public function tearDown():Void { 19 | delete instance; 20 | } 21 | 22 | public function testInstantiated():Void { 23 | assertTrue("ArrayIterator instantiated", instance instanceof ArrayIterator); 24 | } 25 | 26 | public function testIterate():Void { 27 | assertTrue("1", instance.hasNext()); 28 | assertEquals("2", "one", instance.next()); 29 | assertTrue("3", instance.hasNext()); 30 | assertEquals("4", "two", instance.next()); 31 | assertTrue("5", instance.hasNext()); 32 | assertEquals("6", "three", instance.next()); 33 | assertTrue("7", instance.hasNext()); 34 | assertEquals("8", "four", instance.next()); 35 | assertTrue("9", instance.hasNext()); 36 | assertEquals("10", "five", instance.next()); 37 | assertFalse("11", instance.hasNext()); 38 | } 39 | 40 | public function testEmpty():Void { 41 | var itr:ArrayIterator = new ArrayIterator(new Array()); 42 | assertFalse("1", itr.hasNext()); 43 | } 44 | 45 | public function testSingleItem():Void { 46 | var itr:ArrayIterator = new ArrayIterator(new Array("one")); 47 | assertTrue(itr.hasNext()); 48 | assertEquals("2", "one", itr.next()); 49 | assertFalse("3", itr.hasNext()); 50 | 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /asunit-2.5/src/asunit/util/ArrayUtil.as: -------------------------------------------------------------------------------- 1 | class asunit.util.ArrayUtil { public static function indexOf(array:Array, item:Object, fromIndex:Number):Number{ if(fromIndex==undefined) fromIndex = 0; for (var i : Number = fromIndex; i < array.length; i++) { if(array[i]==item) return i; } return -1; } public static function forEach(array:Array, func:Function, thisObject:Object):Void{ if(thisObject==undefined) thisObject = null; for (var i:Number = 0; i < array.length; i++) { func.call(thisObject, array[i], i, array); } } public static function every(array:Array, func:Function, thisObject:Object):Boolean{ if(thisObject==undefined) thisObject = null; for (var i : Number = 0; i < array.length; i++) { if(!func.call(thisObject, array[i], i, array)) return false; } return true; } } -------------------------------------------------------------------------------- /asunit-2.5/src/asunit/util/Iterator.as: -------------------------------------------------------------------------------- 1 | interface asunit.util.Iterator { 2 | function next():Object; 3 | function hasNext():Boolean; 4 | function reset():Void; 5 | } -------------------------------------------------------------------------------- /asunit-2.5/src/asunit/util/Properties.as: -------------------------------------------------------------------------------- 1 | import asunit.errors.UnimplementedFeatureError; 2 | import asunit.flash.errors.IllegalOperationError; 3 | 4 | dynamic class asunit.util.Properties { 5 | 6 | public function store(sharedObjectId:String):Void { 7 | throw new UnimplementedFeatureError("Properties.store"); 8 | } 9 | 10 | public function put(key:String, value:Object):Void { 11 | this[key] = value; 12 | } 13 | 14 | public function setProperty(key:String, value:Object):Void { 15 | put(key, value); 16 | } 17 | 18 | public function getProperty(key:String):Object { 19 | try { 20 | return this[key]; 21 | } 22 | catch(e:Error) { 23 | throw IllegalOperationError("Properties.getProperty"); 24 | } 25 | return null; 26 | } 27 | } -------------------------------------------------------------------------------- /asunit-2.5/test/AllTests.as: -------------------------------------------------------------------------------- 1 | import asunit.framework.TestSuite; 2 | import asunit.framework.AssertTest; 3 | import asunit.framework.AsyncMethodTest; 4 | import asunit.framework.TestCaseTest; 5 | import asunit.framework.TestFailureTest; 6 | import asunit.framework.VisualTestCaseTest; 7 | import asunit.textui.TestRunnerTest; 8 | import asunit.util.ArrayIteratorTest; 9 | 10 | class AllTests extends TestSuite { 11 | 12 | public function AllTests() { 13 | addTest(new asunit.framework.AssertTest()); 14 | addTest(new asunit.framework.AsyncMethodTest()); 15 | addTest(new asunit.framework.TestCaseTest()); 16 | addTest(new asunit.framework.TestFailureTest()); 17 | addTest(new asunit.framework.VisualTestCaseTest()); 18 | addTest(new asunit.textui.TestRunnerTest()); 19 | addTest(new asunit.util.ArrayIteratorTest()); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /asunit-2.5/test/AsUnitRunner.as: -------------------------------------------------------------------------------- 1 | import asunit.textui.TestRunner; 2 | import AllTests; 3 | 4 | class AsUnitRunner extends TestRunner { 5 | 6 | public static function main(container:MovieClip) : Void { 7 | var tR = new AsUnitRunner(); 8 | } 9 | 10 | public function AsUnitRunner() { 11 | start(AllTests); 12 | } 13 | } -------------------------------------------------------------------------------- /asunit-2.5/test/asunit/AllTests.as: -------------------------------------------------------------------------------- 1 | import asunit.framework.TestSuite; 2 | import asunit.framework.AllTests; 3 | import asunit.textui.AllTests; 4 | import asunit.util.AllTests; 5 | 6 | class asunit.AllTests extends TestSuite { 7 | 8 | public function AllTests() { 9 | addTest(new asunit.framework.AllTests()); 10 | addTest(new asunit.textui.AllTests()); 11 | addTest(new asunit.util.AllTests()); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /asunit-2.5/test/asunit/framework/AllTests.as: -------------------------------------------------------------------------------- 1 | import asunit.framework.TestSuite; 2 | import asunit.framework.AssertTest; 3 | import asunit.framework.AsyncMethodTest; 4 | import asunit.framework.TestCaseTest; 5 | import asunit.framework.TestFailureTest; 6 | import asunit.framework.VisualTestCaseTest; 7 | 8 | class asunit.framework.AllTests extends TestSuite { 9 | 10 | public function AllTests() { 11 | addTest(new asunit.framework.AssertTest()); 12 | addTest(new asunit.framework.AsyncMethodTest()); 13 | addTest(new asunit.framework.TestCaseTest()); 14 | addTest(new asunit.framework.TestFailureTest()); 15 | addTest(new asunit.framework.VisualTestCaseTest()); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /asunit-2.5/test/asunit/framework/MockData.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /asunit-2.5/test/asunit/framework/TestCaseStub.as: -------------------------------------------------------------------------------- 1 | import asunit.framework.TestCase; 2 | 3 | class asunit.framework.TestCaseStub extends TestCase { 4 | 5 | public var className:String = "asunit.framework.TestCaseMock"; 6 | 7 | public var testMethod1Run:Boolean; 8 | public var testMethod2Run:Boolean; 9 | public var testMethod3Run:Boolean; 10 | 11 | public function TestCaseStub(methodName:String) { 12 | super(methodName); 13 | } 14 | 15 | public function testMethod1():Void { 16 | testMethod1Run = true; 17 | } 18 | 19 | public function testMethod2():Void { 20 | testMethod2Run = true; 21 | } 22 | 23 | public function testMethod3():Void { 24 | testMethod3Run = true; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /asunit-2.5/test/asunit/framework/TestFailureTest.as: -------------------------------------------------------------------------------- 1 | import asunit.framework.TestFailure; 2 | import asunit.framework.TestCase; 3 | 4 | class asunit.framework.TestFailureTest extends TestCase { 5 | 6 | public var className:String = "asunit.framework.TestFailureTest"; 7 | 8 | public function TestFailureTest(testMethod:String) { 9 | super(testMethod); 10 | } 11 | 12 | public function testInstantiated():Void { 13 | var failure : TestFailure = new TestFailure(this, new Error()); 14 | assertTrue(failure instanceof TestFailure); 15 | } 16 | } -------------------------------------------------------------------------------- /asunit-2.5/test/asunit/framework/VisualTestCaseTest.as: -------------------------------------------------------------------------------- 1 | import asunit.framework.TestCase; 2 | 3 | class asunit.framework.VisualTestCaseTest extends TestCase { 4 | 5 | public var className:String = "asunit.framework.VisualTestCaseTest"; 6 | 7 | private var instance:MovieClip; 8 | 9 | public function VisualTestCaseTest(testMethod:String) { 10 | super(testMethod); 11 | } 12 | 13 | private function setUp():Void { 14 | instance = context.createEmptyMovieClip("instance", context.getNextHighestDepth()); 15 | } 16 | 17 | private function tearDown():Void { 18 | instance.removeMovieClip(); 19 | } 20 | 21 | public function testInstance():Void { 22 | assertTrue(instance instanceof MovieClip); 23 | } 24 | 25 | public function testSize():Void { 26 | assertTrue(instance._width == 0); 27 | assertTrue(instance._height == 0); 28 | } 29 | 30 | public function testDrawnSize():Void { 31 | instance.beginFill(0xFF0000); 32 | instance.moveTo(0,0); 33 | instance.lineTo(10, 0); 34 | instance.lineTo(10, 20); 35 | instance.lineTo(0, 20); 36 | instance.lineTo(0, 0); 37 | 38 | assertTrue(instance._width == 10); 39 | assertTrue(instance._height == 20); 40 | } 41 | 42 | public function testSecondSize():Void { 43 | assertTrue(instance._width == 0); 44 | assertTrue(instance._height == 0); 45 | } 46 | 47 | } -------------------------------------------------------------------------------- /asunit-2.5/test/asunit/runner/BaseTestRunnerMock.as: -------------------------------------------------------------------------------- 1 | import asunit.runner.BaseTestRunner; 2 | class asunit.runner.BaseTestRunnerMock extends BaseTestRunner { 3 | } -------------------------------------------------------------------------------- /asunit-2.5/test/asunit/textui/AllTests.as: -------------------------------------------------------------------------------- 1 | import asunit.framework.TestSuite; 2 | import asunit.textui.TestRunnerTest; 3 | 4 | class asunit.textui.AllTests extends TestSuite { 5 | 6 | public function AllTests() { 7 | addTest(new asunit.textui.TestRunnerTest()); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /asunit-2.5/test/asunit/textui/TestRunnerTest.as: -------------------------------------------------------------------------------- 1 | import asunit.textui.TestRunner; 2 | import asunit.framework.TestCase; 3 | 4 | class asunit.textui.TestRunnerTest extends TestCase { 5 | 6 | public var className:String = "asunit.textui.TestRunnerTest"; 7 | 8 | private var instance : TestRunner; 9 | 10 | public function TestRunnerTest(testMethod:String) { 11 | super(testMethod); 12 | } 13 | 14 | private function setUp():Void { 15 | instance = new TestRunner(); 16 | } 17 | 18 | private function tearDown():Void { 19 | instance = null; 20 | } 21 | 22 | public function testInstantiated():Void { 23 | assertTrue("TestRunner instantiated with: " + instance, instance instanceof TestRunner); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /asunit-2.5/test/asunit/textui/TestRunnerTestCaseMock.as: -------------------------------------------------------------------------------- 1 | import asunit.framework.TestCase; 2 | 3 | class asunit.textui.TestRunnerTestCaseMock extends TestCase { 4 | public var testMethod1Run:Boolean; 5 | public var testMethod2Run:Boolean; 6 | public var testMethod3Run:Boolean; 7 | 8 | public function TestRunnerTestCaseMock(methodName:String) { 9 | super(methodName); 10 | } 11 | 12 | public function testMethod1():Void { 13 | testMethod1Run = true; 14 | } 15 | 16 | public function testMethod1Completed():Void { 17 | trace("testMethod1Handler called"); 18 | } 19 | 20 | public function testMethod2():Void { 21 | testMethod2Run = true; 22 | } 23 | 24 | public function testMethod3():Void { 25 | testMethod3Run = true; 26 | } 27 | } -------------------------------------------------------------------------------- /asunit-2.5/test/asunit/util/AllTests.as: -------------------------------------------------------------------------------- 1 | import asunit.framework.TestSuite; 2 | import asunit.util.ArrayIteratorTest; 3 | 4 | class asunit.util.AllTests extends TestSuite { 5 | 6 | public function AllTests() { 7 | addTest(new asunit.util.ArrayIteratorTest()); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /asunit-2.5/test/asunit/util/ArrayIteratorTest.as: -------------------------------------------------------------------------------- 1 | import asunit.util.ArrayIterator; 2 | import asunit.framework.TestCase; 3 | 4 | class asunit.util.ArrayIteratorTest extends TestCase { 5 | 6 | public var className:String = "asunit.util.ArrayIteratorTest"; 7 | 8 | private var itr : ArrayIterator; 9 | 10 | public function ArrayIteratorTest(testMethod:String) { 11 | super(testMethod); 12 | } 13 | 14 | private function setUp():Void { 15 | itr = new ArrayIterator(getSimpleArray(5)); 16 | } 17 | 18 | private function getSimpleArray(count:Number):Array { 19 | var arr:Array = new Array(); 20 | for(var i:Number = 0; i < count; i++) { 21 | arr.push("item-" + i); 22 | } 23 | return arr; 24 | } 25 | 26 | private function tearDown():Void { 27 | itr = null; 28 | } 29 | 30 | public function testInstantiated():Void { 31 | assertTrue("ArrayIterator instantiated", itr instanceof ArrayIterator); 32 | } 33 | 34 | public function testHasNext():Void { 35 | assertTrue(itr.hasNext()); 36 | } 37 | 38 | public function testNext():Void { 39 | assertEquals("item-0", itr.next()); 40 | } 41 | 42 | public function testNextTwice():Void { 43 | assertEquals("item-0", itr.next()); 44 | assertEquals("item-1", itr.next()); 45 | } 46 | 47 | public function testLast():Void { 48 | assertTrue(itr.hasNext()); 49 | assertEquals("item-0", itr.next()); 50 | assertTrue(itr.hasNext()); 51 | assertEquals("item-1", itr.next()); 52 | assertTrue(itr.hasNext()); 53 | assertEquals("item-2", itr.next()); 54 | assertTrue(itr.hasNext()); 55 | assertEquals("item-3", itr.next()); 56 | assertTrue(itr.hasNext()); 57 | assertEquals("item-4", itr.next()); 58 | assertFalse(itr.hasNext()); 59 | } 60 | 61 | public function testReset():Void { 62 | testLast(); 63 | itr.reset(); 64 | assertTrue(itr.hasNext()); 65 | assertEquals("item-0", itr.next()); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /asunit-3.0/MIT-LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /asunit-3.0/README.textile: -------------------------------------------------------------------------------- 1 | 2 | h1. AsUnit 3.x 3 | 4 | This build of the AsUnit test framework should support Flash Players 9, 10 and Adobe AIR. 5 | 6 | This framework includes runner base classes for ActionScript 3, Flex MXML or Adobe AIR test runners. 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /asunit-3.0/examples/asunit/framework/AsynchronousTestMethodExample.as: -------------------------------------------------------------------------------- 1 | //Assume we have a feature that performs some asynchronous action: 2 | 3 | package net { 4 | 5 | import flash.events.Event; 6 | import flash.events.EventDispatcher; 7 | import flash.utils.setTimeout; 8 | 9 | [Event(name="complete", type="flash.events.Event")] 10 | public class AsyncMethod extends EventDispatcher { 11 | 12 | public function doSomething():void { 13 | setTimeout(function():void { 14 | dispatchEvent(new Event(Event.COMPLETE)); 15 | }, 100); 16 | } 17 | } 18 | } 19 | 20 | //We can test this feature with the following test case: 21 | package net { 22 | 23 | import asunit.framework.TestCase; 24 | import flash.events.Event; 25 | 26 | public class AsyncMethodTest extends TestCase { 27 | private var instance:AsyncMethod; 28 | 29 | public function AsyncMethodTest(methodName:String=null) { 30 | super(methodName) 31 | } 32 | 33 | override protected function setUp():void { 34 | super.setUp(); 35 | instance = new AsyncMethod(); 36 | } 37 | 38 | override protected function tearDown():void { 39 | super.tearDown(); 40 | instance = null; 41 | } 42 | 43 | public function testInstantiated():void { 44 | assertTrue("instance is AsyncMethod", instance is AsyncMethod); 45 | } 46 | 47 | public function testDoSomething():void { 48 | instance.addEventListener(Event.COMPLETE, addAsync()); 49 | instance.doSomething(); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /asunit-3.0/examples/asunit/framework/ComponentTestExample.as: -------------------------------------------------------------------------------- 1 | /* 2 | And finally, the test case that will validate the ViewComponent class and 3 | it's goToHalfSize method. 4 | */ 5 | 6 | package controls { 7 | 8 | import asunit.framework.TestCase; 9 | 10 | public class ViewComponentTest extends TestCase { 11 | private var instance:ViewComponent; 12 | 13 | public function ViewComponentTest(methodName:String=null) { 14 | super(methodName) 15 | } 16 | 17 | override protected function setUp():void { 18 | super.setUp(); 19 | instance = new ViewComponent(); 20 | addChild(instance); 21 | } 22 | 23 | override protected function tearDown():void { 24 | super.tearDown(); 25 | removeChild(instance); 26 | instance = null; 27 | } 28 | 29 | public function testInstantiated():void { 30 | assertTrue("instance is ViewComponent", instance is ViewComponent); 31 | } 32 | 33 | public function testGoToHalfSize():void { 34 | instance.width = 400; 35 | instance.height = 200; 36 | instance.goToHalfSize(); 37 | 38 | assertEquals('width', 200, instance.width); 39 | assertEquals('height', 100, instance.height); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /asunit-3.0/examples/asunit/framework/ComponentTestIntroduction.as: -------------------------------------------------------------------------------- 1 | /* 2 | For the purpose of the following test example, we'll be using a Runner that 3 | looks like this: 4 | */ 5 | 6 | package { 7 | import asunit.textui.TestRunner; 8 | import controls.ViewComponentTest; 9 | 10 | public class SomeProjectRunner extends TestRunner { 11 | 12 | public function SomeProjectRunner() { 13 | // start(clazz:Class, methodName:String, showTrace:Boolean) 14 | // NOTE: sending a particular class and method name will 15 | // execute setUp(), the method and NOT tearDown. 16 | // This allows you to get visual confirmation while developing 17 | // visual entities 18 | start(ViewComponentTest, 'testGoToHalfSize', TestRunner.SHOW_TRACE); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /asunit-3.0/examples/asunit/framework/ComponentUnderTest.as: -------------------------------------------------------------------------------- 1 | /* 2 | The following Component is a visual component whose primary feature 3 | is the 'goToHalfSize' method. 4 | */ 5 | 6 | package controls { 7 | 8 | import flash.display.Sprite; 9 | import flash.events.Event; 10 | 11 | public class ViewComponent extends Sprite { 12 | 13 | private var _width:Number; 14 | private var _height:Number; 15 | 16 | public function ViewComponent() { 17 | _width = 640; 18 | _height = 480; 19 | } 20 | 21 | public function draw():void { 22 | graphics.clear(); 23 | graphics.beginFill(0xFFCC00); 24 | graphics.drawRect(0, 0, width, height); 25 | graphics.endFill(); 26 | } 27 | 28 | public function goToHalfSize():void { 29 | width = Math.round(width / 2); 30 | height = Math.round(height / 2); 31 | draw(); 32 | } 33 | 34 | override public function set width(width:Number):void { 35 | _width = width; 36 | } 37 | 38 | override public function get width():Number { 39 | return _width; 40 | } 41 | 42 | override public function set height(height:Number):void { 43 | _height = height; 44 | } 45 | 46 | override public function get height():Number { 47 | return _height; 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /asunit-3.0/examples/asunit/framework/MathUtil.as: -------------------------------------------------------------------------------- 1 | package utils { 2 | 3 | public class MathUtil { 4 | 5 | public function MathUtil() { 6 | } 7 | 8 | public function addOne(num:Number):Number { 9 | return num + 1; 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /asunit-3.0/examples/asunit/framework/MathUtilTest.as: -------------------------------------------------------------------------------- 1 | // Assume we are testing a class that looks like this: 2 | package utils { 3 | 4 | public class MathUtil { 5 | 6 | // Add one to the number provided: 7 | public function addOne(num:Number):Number { 8 | return num + 1; 9 | } 10 | } 11 | } 12 | 13 | 14 | // This is a test case for the class above: 15 | package utils { 16 | 17 | import asunit.framework.TestCase; 18 | 19 | public class MathUtilTest extends TestCase { 20 | private var mathUtil:MathUtil; 21 | 22 | public function MathUtilTest(methodName:String=null) { 23 | super(methodName) 24 | } 25 | 26 | override protected function setUp():void { 27 | super.setUp(); 28 | mathUtil = new MathUtil(); 29 | } 30 | 31 | override protected function tearDown():void { 32 | super.tearDown(); 33 | mathUtil = null; 34 | } 35 | 36 | public function testInstantiated():void { 37 | assertTrue("mathUtil is MathUtil", mathUtil is MathUtil); 38 | } 39 | 40 | public function testAddOne():void { 41 | assertEquals(5, mathUtil.addOne(4)); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /asunit-3.0/examples/asunit/framework/TestSuiteExample.as: -------------------------------------------------------------------------------- 1 | package { 2 | import asunit.framework.TestSuite; 3 | import errors.CustomErrorTest; 4 | import net.CustomRequestTest; 5 | import net.CustomServiceTest; 6 | 7 | public class AllTests extends TestSuite { 8 | 9 | public function AllTests() { 10 | addTest(new errors.CustomErrorTest()); 11 | addTest(new net.CustomRequestTest()); 12 | addTest(new net.CustomServiceTest()); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /asunit-3.0/examples/asunit/textui/AirRunnerExample.mxml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /asunit-3.0/examples/asunit/textui/FlexRunnerExample.mxml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /asunit-3.0/examples/asunit/textui/TestRunnerExample.as: -------------------------------------------------------------------------------- 1 | package { 2 | import asunit.textui.TestRunner; 3 | 4 | public class SomeProjectRunner extends TestRunner { 5 | 6 | public function SomeProjectRunner() { 7 | // start(clazz:Class, methodName:String, showTrace:Boolean) 8 | // NOTE: sending a particular class and method name will 9 | // execute setUp(), the method and NOT tearDown. 10 | // This allows you to get visual confirmation while developing 11 | // visual entities 12 | start(AllTests, null, TestRunner.SHOW_TRACE); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /asunit-3.0/examples/asunit/textui/XMLResultPrinterExample.as: -------------------------------------------------------------------------------- 1 | package { 2 | import asunit.textui.TestRunner; 3 | import asunit.textui.XMLResultPrinter; 4 | 5 | public class XMLResultPrinterExample extends TestRunner { 6 | 7 | public function XMLResultPrinterExample() { 8 | // start(clazz:Class, methodName:String, showTrace:Boolean) 9 | // NOTE: sending a particular class and method name will 10 | // execute setUp(), the method and NOT tearDown. 11 | // This allows you to get visual confirmation while developing 12 | // visual entities 13 | setPrinter(new XMLResultPrinter()); 14 | start(AllTests, null, TestRunner.SHOW_TRACE); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /asunit-3.0/examples/asunit/textui/XMLResultPrinterExample.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Reference runtime test error 8 | 9 | 10 | Reference assertion test failure 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /asunit-3.0/rakefile.rb: -------------------------------------------------------------------------------- 1 | require 'sprout' 2 | sprout 'as3' 3 | 4 | ASUNIT_VERSION = '2.8' 5 | 6 | ########################################## 7 | # To build from this file, install Ruby (http://ruby-lang.org) 8 | # and RubyGems (http://rubygems.org/), then run: 9 | # gem install sprout 10 | # gem install rake 11 | # rake 12 | # This should walk you through the installation 13 | # of required gems, compilers and vms 14 | 15 | ########################################## 16 | # Compile the Test Harness 17 | 18 | desc "Compile the test harness" 19 | mxmlc 'bin/AsUnitRunner.swf' do |t| 20 | t.default_size = '1000 600' 21 | t.source_path << 'src' 22 | t.input = 'test/AsUnitRunner.as' 23 | end 24 | 25 | ########################################## 26 | # Generate documentation 27 | 28 | desc "Generate documentation" 29 | asdoc 'doc' do |t| 30 | t.appended_args = '-examples-path=examples' 31 | t.source_path << 'src' 32 | t.doc_classes << 'AsUnit' 33 | 34 | # Include air swcs to avoid failures 35 | # on AirRunner: 36 | t.library_path << 'lib/airglobal.swc' 37 | t.library_path << 'lib/airframework.swc' 38 | end 39 | 40 | ########################################## 41 | # Launch the Test Harness 42 | 43 | desc "Compile and run the test harness" 44 | flashplayer :run => 'bin/AsUnitRunner.swf' 45 | 46 | ########################################## 47 | # Package framework ZIPs and SWCs 48 | 49 | archive = "bin/asunit3.#{ASUNIT_VERSION}.zip" 50 | 51 | zip archive do |t| 52 | t.input = 'src/asunit' 53 | puts "Created zip archive at: #{archive}" 54 | end 55 | 56 | desc "Create zip archives" 57 | task :zip => archive 58 | 59 | ########################################## 60 | # Set up task wrappers 61 | 62 | task :default => :run 63 | 64 | desc "Alias to the default task" 65 | task :test => :run 66 | -------------------------------------------------------------------------------- /asunit-3.0/src/asunit/errors/AbstractError.as: -------------------------------------------------------------------------------- 1 | package asunit.errors { 2 | 3 | public class AbstractError extends Error { 4 | 5 | public function AbstractError(message:String) { 6 | super(message); 7 | name = "AbstractError"; 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /asunit-3.0/src/asunit/errors/AssertionFailedError.as: -------------------------------------------------------------------------------- 1 | package asunit.errors { 2 | 3 | public class AssertionFailedError extends Error { 4 | 5 | public function AssertionFailedError(message:String) { 6 | super(message); 7 | name = "AssertionFailedError"; 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /asunit-3.0/src/asunit/errors/ClassNotFoundError.as: -------------------------------------------------------------------------------- 1 | package asunit.errors { 2 | 3 | public class ClassNotFoundError extends Error { 4 | 5 | public function ClassNotFoundError(message:String) { 6 | super(message); 7 | name = "ClassNotFoundError"; 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /asunit-3.0/src/asunit/errors/InstanceNotFoundError.as: -------------------------------------------------------------------------------- 1 | package asunit.errors { 2 | 3 | public class InstanceNotFoundError extends Error { 4 | 5 | public function InstanceNotFoundError(message:String) { 6 | super(message); 7 | name = "InstanceNotFoundError"; 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /asunit-3.0/src/asunit/errors/UnimplementedFeatureError.as: -------------------------------------------------------------------------------- 1 | package asunit.errors { 2 | 3 | public class UnimplementedFeatureError extends Error { 4 | 5 | public function UnimplementedFeatureError(message:String) { 6 | super(message); 7 | name = "UnimplementedFeatureError"; 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /asunit-3.0/src/asunit/framework/AsyncOperation.as: -------------------------------------------------------------------------------- 1 | package asunit.framework { 2 | import asunit.errors.AssertionFailedError; 3 | import flash.errors.IllegalOperationError; 4 | import flash.events.Event; 5 | import flash.events.TimerEvent; 6 | import flash.utils.Timer; 7 | 8 | public class AsyncOperation{ 9 | 10 | private var timeout:Timer; 11 | private var testCase:TestCase; 12 | private var callback:Function; 13 | private var duration:Number; 14 | private var failureHandler:Function; 15 | 16 | public function AsyncOperation(testCase:TestCase, handler:Function, duration:Number, failureHandler:Function=null){ 17 | this.testCase = testCase; 18 | this.duration = duration; 19 | timeout = new Timer(duration, 1); 20 | timeout.addEventListener(TimerEvent.TIMER_COMPLETE, onTimeoutComplete); 21 | timeout.start(); 22 | if(handler == null) { 23 | handler = function(args:*):* {return;}; 24 | } 25 | this.failureHandler = failureHandler; 26 | var context:AsyncOperation = this; 27 | callback = function(args:*):* { 28 | timeout.stop(); 29 | try { 30 | handler.apply(testCase, arguments); 31 | } 32 | catch(e:AssertionFailedError) { 33 | testCase.getResult().addFailure(testCase, e); 34 | } 35 | catch(ioe:IllegalOperationError) { 36 | testCase.getResult().addError(testCase, ioe); 37 | } 38 | catch(unknownError:Error) { 39 | testCase.getResult().addError(testCase, unknownError); 40 | } 41 | finally { 42 | testCase.asyncOperationComplete(context); 43 | } 44 | return; 45 | }; 46 | } 47 | 48 | public function getCallback():Function{ 49 | return callback; 50 | } 51 | 52 | private function onTimeoutComplete(event:TimerEvent):void { 53 | if(null != failureHandler) { 54 | failureHandler(new Event('async timeout')); 55 | } 56 | testCase.asyncOperationTimeout(this, duration, null==failureHandler); 57 | } 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /asunit-3.0/src/asunit/framework/AsynchronousHTTPServiceTestCase.as: -------------------------------------------------------------------------------- 1 | package asunit.framework { 2 | import asunit.errors.AbstractError; 3 | 4 | import flash.errors.IllegalOperationError; 5 | import flash.events.*; 6 | import flash.net.URLLoader; 7 | import flash.utils.getTimer; 8 | 9 | import mx.rpc.AsyncToken; 10 | import mx.rpc.Responder; 11 | import mx.rpc.events.FaultEvent; 12 | 13 | /** 14 | * Extend this class if you have a TestCase that requires the 15 | * asynchronous load of external data. 16 | */ 17 | public class AsynchronousHTTPServiceTestCase extends AsynchronousTestCase implements Test { 18 | 19 | public function AsynchronousHTTPServiceTestCase(testMethod:String = null) { 20 | super(testMethod); 21 | } 22 | 23 | // use this method in overriding run() if you are using an HTTPService: 24 | protected function configureResponder(token:AsyncToken):void { 25 | token.addResponder(new Responder(resultFunc, faultFunc)); 26 | } 27 | 28 | protected function resultFunc(event:Object):void { 29 | completeHandler(event as Event); 30 | } 31 | 32 | protected function faultFunc(event:Object):void { 33 | var faultEvent:FaultEvent = event as FaultEvent; 34 | if (faultEvent == null) { 35 | return; 36 | } 37 | var cause:Object = faultEvent.fault.rootCause; 38 | var ioErrorEvent:IOErrorEvent = cause as IOErrorEvent; 39 | if (ioErrorEvent) { 40 | ioErrorHandler(ioErrorEvent); 41 | return; 42 | } 43 | var securityErrorEvent:SecurityErrorEvent = cause as SecurityErrorEvent; 44 | if (securityErrorEvent) { 45 | securityErrorHandler(securityErrorEvent); 46 | } 47 | } 48 | 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /asunit-3.0/src/asunit/framework/Test.as: -------------------------------------------------------------------------------- 1 | package asunit.framework { 2 | import flash.display.DisplayObjectContainer; 3 | import flash.events.IEventDispatcher; 4 | 5 | public interface Test extends IEventDispatcher { 6 | function countTestCases():int; 7 | function getName():String; 8 | function getTestMethods():Array; 9 | function toString():String; 10 | function setResult(result:TestListener):void; 11 | function run():void; 12 | function runBare():void; 13 | function getCurrentMethod():String; 14 | function getIsComplete():Boolean; 15 | function setContext(context:DisplayObjectContainer):void; 16 | function getContext():DisplayObjectContainer; 17 | } 18 | } -------------------------------------------------------------------------------- /asunit-3.0/src/asunit/framework/TestFailure.as: -------------------------------------------------------------------------------- 1 | package asunit.framework { 2 | import asunit.errors.AssertionFailedError; 3 | 4 | /** 5 | * A TestFailure collects a failed test together with 6 | * the caught exception. 7 | * @see TestResult 8 | */ 9 | public class TestFailure { 10 | protected var fFailedTest:Test; 11 | protected var fFailedTestMethod:String; 12 | protected var fThrownException:Error; 13 | 14 | /** 15 | * Constructs a TestFailure with the given test and exception. 16 | */ 17 | public function TestFailure(failedTest:Test, thrownException:Error) { 18 | fFailedTest = failedTest; 19 | fFailedTestMethod = failedTest.getCurrentMethod(); 20 | fThrownException = thrownException; 21 | } 22 | 23 | public function failedFeature():String { 24 | return failedTest().getName() + '.' + fFailedTestMethod; 25 | } 26 | 27 | public function failedMethod():String { 28 | return fFailedTestMethod; 29 | } 30 | 31 | /** 32 | * Gets the failed test case. 33 | */ 34 | public function failedTest():Test { 35 | return fFailedTest; 36 | } 37 | /** 38 | * Gets the thrown exception. 39 | */ 40 | public function thrownException():Error { 41 | return fThrownException; 42 | } 43 | /** 44 | * Returns a short description of the failure. 45 | */ 46 | public function toString():String { 47 | return ""; 48 | } 49 | 50 | public function exceptionMessage():String { 51 | return thrownException().message; 52 | } 53 | 54 | public function isFailure():Boolean { 55 | return thrownException() is AssertionFailedError; 56 | } 57 | } 58 | } -------------------------------------------------------------------------------- /asunit-3.0/src/asunit/framework/TestListener.as: -------------------------------------------------------------------------------- 1 | package asunit.framework { 2 | import asunit.errors.AssertionFailedError; 3 | 4 | public interface TestListener { 5 | 6 | /** 7 | * Run the provided Test. 8 | */ 9 | function run(test:Test):void; 10 | /** 11 | * A test started. 12 | */ 13 | function startTest(test:Test):void; 14 | /** 15 | * A failure occurred. 16 | */ 17 | function addFailure(test:Test, t:AssertionFailedError):void; 18 | /** 19 | * An error occurred. 20 | */ 21 | function addError(test:Test, t:Error):void; 22 | /** 23 | * A test method has begun execution. 24 | */ 25 | function startTestMethod(test:Test, methodName:String):void; 26 | /** 27 | * A test method has completed. 28 | */ 29 | function endTestMethod(test:Test, methodName:String):void; 30 | /** 31 | * A test ended. 32 | */ 33 | function endTest(test:Test):void; 34 | } 35 | } -------------------------------------------------------------------------------- /asunit-3.0/src/asunit/framework/TestMethod.as: -------------------------------------------------------------------------------- 1 | package asunit.framework { 2 | 3 | import flash.utils.getTimer; 4 | 5 | /** 6 | * A TestFailure collects a failed test together with 7 | * the caught exception. 8 | * @see TestResult 9 | */ 10 | public class TestMethod { 11 | protected var test:Test; 12 | protected var method:String; 13 | 14 | private var _duration:Number; 15 | private var start:Number; 16 | 17 | /** 18 | * Constructs a TestMethod with a given Test and method name. 19 | */ 20 | public function TestMethod(test:Test, method:String) { 21 | this.test = test; 22 | this.method = method; 23 | start = getTimer(); 24 | } 25 | 26 | public function getName():String { 27 | return method; 28 | } 29 | 30 | public function endTest(test:Test):void { 31 | _duration = (getTimer() - start) * .001; 32 | } 33 | 34 | public function duration():Number { 35 | return _duration; 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /asunit-3.0/src/asunit/runner/BaseTestRunner.as: -------------------------------------------------------------------------------- 1 | package asunit.runner { 2 | import flash.display.Sprite; 3 | 4 | /** 5 | * Base class for all test runners. 6 | * This class was born live on stage in Sardinia during XP2000. 7 | */ 8 | public class BaseTestRunner extends Sprite { 9 | 10 | // Filters stack trace to improve readability. 11 | public static function getFilteredTrace(stack:String):String { 12 | // Remove local file paths to focus on the class names preceding them. 13 | var localPathExp:RegExp = /([A-Z]:\\[^\/:\*\?<>\|]+\.\w{2,6})|(\\{2}[^\/:\*\?<>\|]+\.\w{2,6})/g; 14 | stack = stack.replace(localPathExp, ''); 15 | return stack 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /asunit-3.0/src/asunit/runner/TestSuiteLoader.as: -------------------------------------------------------------------------------- 1 | package asunit.runner { 2 | 3 | public interface TestSuiteLoader { 4 | // throws ClassNotFoundException 5 | function load(suiteClassName:String):Class; 6 | // throws ClassNotFoundException 7 | function reload(aClass:Class):Class; 8 | } 9 | } -------------------------------------------------------------------------------- /asunit-3.0/src/asunit/runner/Version.as: -------------------------------------------------------------------------------- 1 | package asunit.runner { 2 | 3 | public class Version { 4 | private static var version:String = "3.0"; 5 | 6 | public static function id():String { 7 | return version.toString(); 8 | } 9 | 10 | } 11 | } -------------------------------------------------------------------------------- /asunit-3.0/src/asunit/textui/AirRunner.as: -------------------------------------------------------------------------------- 1 | package asunit.textui { 2 | import asunit.framework.TestResult; 3 | 4 | import mx.core.WindowedApplication; 5 | 6 | /** 7 | * The base class for Air application runners that use the Flex framework. 8 | * 9 | * @includeExample AirRunnerExample.mxml 10 | * 11 | * @author Ian 12 | * @playerversion AIR 1.1 13 | **/ 14 | public class AirRunner extends WindowedApplication { 15 | 16 | protected var runner:TestRunner; 17 | 18 | override protected function createChildren():void { 19 | super.createChildren(); 20 | runner = new FlexTestRunner(); 21 | rawChildren.addChild(runner); 22 | } 23 | 24 | public function start(testCase:Class, testMethod:String = null, showTrace:Boolean = false) : TestResult { 25 | return runner.start(testCase, testMethod, showTrace); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /asunit-3.0/src/asunit/textui/FlexRunner.as: -------------------------------------------------------------------------------- 1 | package asunit.textui { 2 | import asunit.framework.TestResult; 3 | 4 | import mx.core.Application; 5 | 6 | /** 7 | * The FlexTestRunner should be the base class for your 8 | * test harness if you're testing a project that uses Flex components. 9 | * 10 | * @includeExample FlexRunnerExample.mxml 11 | **/ 12 | public class FlexRunner extends Application { 13 | protected var runner:TestRunner; 14 | 15 | override protected function createChildren():void { 16 | super.createChildren(); 17 | runner = new FlexTestRunner(); 18 | rawChildren.addChild(runner); 19 | } 20 | 21 | public function start(testCase:Class, testMethod:String = null, showTrace:Boolean = false):TestResult { 22 | return runner.start(testCase, testMethod, showTrace); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /asunit-3.0/src/asunit/textui/FlexTestRunner.as: -------------------------------------------------------------------------------- 1 | package asunit.textui { 2 | import flash.display.DisplayObject; 3 | import flash.events.Event; 4 | import mx.core.IUIComponent; 5 | import asunit.textui.TestRunner; 6 | 7 | /** 8 | * @private 9 | **/ 10 | public class FlexTestRunner extends TestRunner { 11 | 12 | public function FlexTestRunner() { 13 | setPrinter(new ResultPrinter()); 14 | } 15 | 16 | protected override function addedHandler(event:Event):void { 17 | if(event.target === this) { 18 | parent.addEventListener(Event.RESIZE, resizeHandler); 19 | resizeHandler(new Event(Event.RESIZE)); 20 | } 21 | else { 22 | event.stopPropagation(); 23 | } 24 | } 25 | 26 | public override function set width(w:Number):void { 27 | fPrinter.width = w; 28 | } 29 | 30 | public override function set height(h:Number):void { 31 | fPrinter.height = h; 32 | } 33 | 34 | public function resizeHandler(event:Event):void { 35 | width = parent.width; 36 | height = parent.height; 37 | } 38 | 39 | public override function addChild(child:DisplayObject):DisplayObject { 40 | if(parent && child is IUIComponent) { 41 | // AND check for 'is' UIUComponent... 42 | return parent.addChild(child); 43 | } 44 | else { 45 | return super.addChild(child); 46 | } 47 | } 48 | 49 | public override function removeChild(child:DisplayObject):DisplayObject { 50 | if(child is IUIComponent) { 51 | return parent.removeChild(child); 52 | } 53 | else { 54 | return super.removeChild(child); 55 | } 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /asunit-3.0/src/asunit/util/ArrayIterator.as: -------------------------------------------------------------------------------- 1 | package asunit.util { 2 | 3 | import asunit.util.Iterator; 4 | 5 | [ExcludeClass] 6 | public class ArrayIterator implements Iterator { 7 | private var list:Array; 8 | private var index:Number = 0; 9 | 10 | public function ArrayIterator(list:Array) { 11 | this.list = list; 12 | } 13 | 14 | public function hasNext():Boolean { 15 | return list[index] != null; 16 | } 17 | 18 | public function next():Object { 19 | return list[index++]; 20 | } 21 | 22 | public function reset():void { 23 | index = 0; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /asunit-3.0/src/asunit/util/Iterator.as: -------------------------------------------------------------------------------- 1 | package asunit.util { 2 | 3 | [ExcludeClass] 4 | public interface Iterator { 5 | function next():Object; 6 | function hasNext():Boolean; 7 | function reset():void; 8 | } 9 | } -------------------------------------------------------------------------------- /asunit-3.0/src/asunit/util/Properties.as: -------------------------------------------------------------------------------- 1 | package asunit.util { 2 | import asunit.errors.UnimplementedFeatureError; 3 | import flash.errors.IllegalOperationError; 4 | 5 | [ExcludeClass] 6 | public dynamic class Properties { 7 | 8 | public function store(sharedObjectId:String):void { 9 | throw new UnimplementedFeatureError("Properties.store"); 10 | } 11 | 12 | public function put(key:String, value:Object):void { 13 | this[key] = value; 14 | } 15 | 16 | public function setProperty(key:String, value:Object):void { 17 | put(key, value); 18 | } 19 | 20 | public function getProperty(key:String):Object { 21 | try { 22 | return this[key]; 23 | } 24 | catch(e:Error) { 25 | throw IllegalOperationError("Properties.getProperty"); 26 | } 27 | return null; 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /asunit-3.0/test/AllTests.as: -------------------------------------------------------------------------------- 1 | package { 2 | import asunit.framework.TestSuite; 3 | import asunit.AllTests; 4 | 5 | public class AllTests extends TestSuite { 6 | 7 | public function AllTests() { 8 | addTest(new asunit.AllTests()); 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /asunit-3.0/test/AsUnitRunner.as: -------------------------------------------------------------------------------- 1 | package { 2 | import asunit.textui.TestRunner; 3 | 4 | public class AsUnitRunner extends TestRunner { 5 | 6 | public function AsUnitRunner() { 7 | start(AllTests); 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /asunit-3.0/test/asunit/AllTests.as: -------------------------------------------------------------------------------- 1 | package asunit { 2 | import asunit.framework.TestSuite; 3 | import asunit.framework.AllTests; 4 | import asunit.textui.AllTests; 5 | import asunit.util.AllTests; 6 | 7 | public class AllTests extends TestSuite { 8 | 9 | public function AllTests() { 10 | addTest(new asunit.framework.AllTests()); 11 | addTest(new asunit.textui.AllTests()); 12 | addTest(new asunit.util.AllTests()); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /asunit-3.0/test/asunit/framework/AllTests.as: -------------------------------------------------------------------------------- 1 | package asunit.framework { 2 | import asunit.framework.TestSuite; 3 | import asunit.framework.AssertEqualsArraysIgnoringOrderTest; 4 | import asunit.framework.AssertEqualsArraysTest; 5 | import asunit.framework.AssertTest; 6 | import asunit.framework.AssertThrowsTest; 7 | import asunit.framework.AsyncFailureTest; 8 | import asunit.framework.AsyncMethodTest; 9 | import asunit.framework.TestCaseTest; 10 | import asunit.framework.TestFailureTest; 11 | import asunit.framework.VisualTestCaseTest; 12 | 13 | public class AllTests extends TestSuite { 14 | 15 | public function AllTests() { 16 | addTest(new asunit.framework.AssertEqualsArraysIgnoringOrderTest()); 17 | addTest(new asunit.framework.AssertEqualsArraysTest()); 18 | addTest(new asunit.framework.AssertTest()); 19 | addTest(new asunit.framework.AssertThrowsTest()); 20 | addTest(new asunit.framework.AsyncFailureTest()); 21 | addTest(new asunit.framework.AsyncMethodTest()); 22 | addTest(new asunit.framework.TestCaseTest()); 23 | addTest(new asunit.framework.TestFailureTest()); 24 | addTest(new asunit.framework.VisualTestCaseTest()); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /asunit-3.0/test/asunit/framework/AssertThrowsTest.as: -------------------------------------------------------------------------------- 1 | package asunit.framework { 2 | import asunit.errors.AssertionFailedError; 3 | 4 | public class AssertThrowsTest extends TestCase { 5 | 6 | public function AssertThrowsTest(testMethod:String = null) { 7 | super(testMethod); 8 | } 9 | 10 | public function test_throwing_correct_error_passes():void { 11 | assertThrows(ArgumentError, function():void { throw new ArgumentError(); } ); 12 | } 13 | 14 | public function test_throwing_incorrect_error_fails_with_expected_message():void { 15 | try { 16 | assertThrows(ArgumentError, function():void { throw new Error("wrong error type"); } ); 17 | } 18 | catch (e:AssertionFailedError) { 19 | assertEquals("expected error type: but was:", e.message) 20 | return; 21 | } 22 | fail('failed assertThrows() should have thrown AssertionFailedError'); 23 | } 24 | 25 | /** 26 | * Captures a bug in original assertThrows implementation 27 | * where the message when nothing was thrown said "but was:". 28 | */ 29 | public function test_throwing_no_error_fails_with_message_that_none_was_thrown():void { 30 | try { 31 | assertThrows(ArgumentError, function():void { } ); 32 | } 33 | catch (e:AssertionFailedError) { 34 | assertEquals("expected error type: but none was thrown.", e.message) 35 | return; 36 | } 37 | fail('failed assertThrows() should have thrown AssertionFailedError'); 38 | } 39 | 40 | 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /asunit-3.0/test/asunit/framework/AsyncFailureTest.as: -------------------------------------------------------------------------------- 1 | package asunit.framework { 2 | import flash.display.Sprite; 3 | import flash.utils.setTimeout; 4 | import flash.utils.Timer; 5 | import flash.events.TimerEvent; 6 | 7 | public class AsyncFailureTest extends TestCase { 8 | public function AsyncFailureTest(testMethod:String = null) { 9 | super(testMethod); 10 | } 11 | 12 | protected override function setUp():void { 13 | } 14 | 15 | protected override function tearDown():void { 16 | } 17 | 18 | public function testSuccess():void{ 19 | var wasCalled:Boolean; 20 | function onAsync():void { 21 | wasCalled = true; 22 | } 23 | function onDone(event:TimerEvent):void { 24 | assertTrue(wasCalled); 25 | } 26 | 27 | var handler:Function = addAsync(onAsync, 1000); 28 | var timer:Timer = new Timer(3000, 1); 29 | timer.addEventListener(TimerEvent.TIMER, onDone); 30 | timer.start(); 31 | handler(); 32 | } 33 | 34 | public function testAsyncFailed():void{ 35 | var wasCalled:Boolean; 36 | var failed:Boolean; 37 | function onAsync():void { 38 | wasCalled = true; 39 | fail("Shouldn't have been called"); 40 | } 41 | function onDone(event:TimerEvent):void { 42 | assertFalse(wasCalled); 43 | assertTrue(failed); 44 | } 45 | function onFailure():void { 46 | failed = true; 47 | } 48 | 49 | var handler:Function = addAsync(onAsync, 0, onFailure); 50 | var timer:Timer = new Timer(50, 1); 51 | timer.addEventListener(TimerEvent.TIMER, onDone); 52 | timer.start(); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /asunit-3.0/test/asunit/framework/MockData.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /asunit-3.0/test/asunit/framework/TestCaseMock.as: -------------------------------------------------------------------------------- 1 | package asunit.framework { 2 | 3 | public class TestCaseMock extends TestCase { 4 | public var testMethod1Run:Boolean; 5 | public var testMethod2Run:Boolean; 6 | public var testMethod3Run:Boolean; 7 | 8 | public function TestCaseMock(methodName:String = null) { 9 | super(methodName); 10 | } 11 | 12 | public function testMethod1():void { 13 | testMethod1Run = true; 14 | } 15 | 16 | public function testMethod2():void { 17 | testMethod2Run = true; 18 | } 19 | 20 | public function testMethod3():void { 21 | testMethod3Run = true; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /asunit-3.0/test/asunit/framework/TestFailureTest.as: -------------------------------------------------------------------------------- 1 | package asunit.framework { 2 | 3 | public class TestFailureTest extends TestCase { 4 | 5 | public function TestFailureTest(testMethod:String = null) { 6 | super(testMethod); 7 | } 8 | 9 | public function testInstantiated():void { 10 | var failure:TestFailure = new TestFailure(this, new Error()); 11 | assertTrue(failure is TestFailure); 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /asunit-3.0/test/asunit/framework/VisualTestCaseTest.as: -------------------------------------------------------------------------------- 1 | package asunit.framework { 2 | import flash.display.Sprite; 3 | 4 | public class VisualTestCaseTest extends TestCase { 5 | private var instance:Sprite; 6 | 7 | public function VisualTestCaseTest(testMethod:String = null) { 8 | super(testMethod); 9 | } 10 | 11 | protected override function setUp():void { 12 | instance = new Sprite(); 13 | addChild(instance); 14 | } 15 | 16 | protected override function tearDown():void { 17 | removeChild(instance); 18 | } 19 | 20 | public function testInstance():void { 21 | assertTrue(instance is Sprite); 22 | } 23 | 24 | public function testSize():void { 25 | assertTrue(instance.width == 0); 26 | assertTrue(instance.height == 0); 27 | } 28 | 29 | public function testDrawnSize():void { 30 | instance.graphics.beginFill(0xFF0000); 31 | instance.graphics.drawRect(0, 0, 10, 20); 32 | 33 | assertTrue(instance.width == 10); 34 | assertTrue(instance.height == 20); 35 | } 36 | 37 | public function testSecondSize():void { 38 | assertTrue(instance.width == 0); 39 | assertTrue(instance.height == 0); 40 | } 41 | 42 | } 43 | } -------------------------------------------------------------------------------- /asunit-3.0/test/asunit/framework/assertAssertionFailed.as: -------------------------------------------------------------------------------- 1 | package asunit.framework 2 | { 3 | import asunit.errors.AssertionFailedError; 4 | import asunit.framework.Assert; 5 | 6 | internal function assertAssertionFailed(assertFunction:Function, expected:Object, actual:Object):void { 7 | var succeeded:Boolean = false; 8 | try { 9 | assertFunction.apply(null, [expected, actual]); 10 | succeeded = true; 11 | } 12 | catch (e:AssertionFailedError) { 13 | // expected 14 | } 15 | if (succeeded) { 16 | Assert.fail("expected AssertionFailedError"); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /asunit-3.0/test/asunit/runner/BaseTestRunnerMock.as: -------------------------------------------------------------------------------- 1 | package asunit.runner { 2 | 3 | public class BaseTestRunnerMock extends BaseTestRunner { 4 | 5 | } 6 | } -------------------------------------------------------------------------------- /asunit-3.0/test/asunit/textui/AllTests.as: -------------------------------------------------------------------------------- 1 | package asunit.textui { 2 | import asunit.framework.TestSuite; 3 | import asunit.textui.TestRunnerTest; 4 | 5 | public class AllTests extends TestSuite { 6 | 7 | public function AllTests() { 8 | addTest(new asunit.textui.TestRunnerTest()); 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /asunit-3.0/test/asunit/textui/TestRunnerTest.as: -------------------------------------------------------------------------------- 1 | package asunit.textui { 2 | import asunit.framework.TestCase; 3 | 4 | public class TestRunnerTest extends TestCase { 5 | private var instance:TestRunner; 6 | 7 | public function TestRunnerTest(testMethod:String = null) { 8 | super(testMethod); 9 | } 10 | 11 | protected override function setUp():void { 12 | instance = new TestRunner(); 13 | addChild(instance); 14 | } 15 | 16 | protected override function tearDown():void { 17 | removeChild(instance); 18 | instance = null; 19 | } 20 | 21 | public function testInstantiated():void { 22 | assertTrue("TestRunner instantiated with: " + instance, instance is TestRunner); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /asunit-3.0/test/asunit/textui/TestRunnerTestCaseMock.as: -------------------------------------------------------------------------------- 1 | package asunit.textui { 2 | 3 | import asunit.framework.TestCase; 4 | 5 | public class TestRunnerTestCaseMock extends TestCase { 6 | public var testMethod1Run:Boolean; 7 | public var testMethod2Run:Boolean; 8 | public var testMethod3Run:Boolean; 9 | 10 | public function TestRunnerTestCaseMock(methodName:String = null) { 11 | super(methodName); 12 | } 13 | 14 | public function testMethod1():void { 15 | testMethod1Run = true; 16 | } 17 | 18 | public function testMethod1Completed():void { 19 | trace("testMethod1Handler called"); 20 | } 21 | 22 | public function testMethod2():void { 23 | testMethod2Run = true; 24 | } 25 | 26 | public function testMethod3():void { 27 | testMethod3Run = true; 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /asunit-3.0/test/asunit/util/AllTests.as: -------------------------------------------------------------------------------- 1 | package asunit.util { 2 | import asunit.framework.TestSuite; 3 | import asunit.util.ArrayIteratorTest; 4 | 5 | public class AllTests extends TestSuite { 6 | 7 | public function AllTests() { 8 | addTest(new asunit.util.ArrayIteratorTest()); 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /asunit-4.0/.as3_classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | src 4 | test 5 | lib/Reflection.swc 6 | playerglobal.swc 7 | flex.swc 8 | framework.swc 9 | rpc.swc 10 | utilities.swc 11 | 12 | -------------------------------------------------------------------------------- /asunit-4.0/.gitignore: -------------------------------------------------------------------------------- 1 | *.tmproj 2 | doc/* 3 | bin/*.swc 4 | bin/*.swf 5 | test/generated 6 | bin/generated 7 | pkg 8 | -------------------------------------------------------------------------------- /asunit-4.0/Gemfile: -------------------------------------------------------------------------------- 1 | source :rubygems 2 | 3 | gem 'flashsdk', '>= 1.0.2.pre' 4 | 5 | group :development do 6 | gem "shoulda" 7 | gem "mocha" 8 | end 9 | 10 | -------------------------------------------------------------------------------- /asunit-4.0/MIT-LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /asunit-4.0/README.textile: -------------------------------------------------------------------------------- 1 | 2 | h1. AsUnit 4.x 3 | 4 | This build of the AsUnit test framework works with Flash Players 9, 10 and Adobe AIR and any version of the Flex framework. 5 | 6 | 7 | -------------------------------------------------------------------------------- /asunit-4.0/air/AIR2Runner.mxml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /asunit-4.0/air/AIR2RunnerDescriptor.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | AsUnitAIRRunner 4 | 2.0 5 | AsUnitAIRRunner 6 | AsUnit AIR Runner 7 | 8 | AsUnit AIR Runner 9 | 10 | Copyright (c) 2010 Example Co. 11 | 12 | AsUnit 13 | 14 | bin/AIR2AsUnitRunner.swf 15 | 16 | standard 17 | false 18 | true 19 | true 20 | true 21 | true 22 | 900 23 | 500 24 | 640 480 25 | 1280 960 26 | 27 | AsUnit/AIR2Runner 28 | AsUnit/AIR2Runner 29 | 30 | icons/smallIcon.png 31 | icons/mediumIcon.png 32 | icons/bigIcon.png 33 | icons/biggestIcon.png 34 | 35 | true 36 | false 37 | 38 | 39 | -------------------------------------------------------------------------------- /asunit-4.0/asunit4.gemspec: -------------------------------------------------------------------------------- 1 | # -*- encoding: utf-8 -*- 2 | 3 | require File.join(File.dirname(__FILE__), 'sprout', 'lib', 'asunit4') 4 | require 'rake' 5 | 6 | Gem::Specification.new do |s| 7 | s.name = AsUnit::NAME 8 | s.version = AsUnit::VERSION 9 | s.platform = Gem::Platform::RUBY 10 | s.authors = ["Luke Bayes", "Ali Mills", "Robert Penner"] 11 | s.email = ["asunit-users@lists.sourceforge.net"] 12 | s.homepage = "http://asunit.org" 13 | s.summary = "The fastest and most flexible ActionScript unit test framework" 14 | s.description = "AsUnit is the only ActionScript unit test framework that support every development and runtime environment that is currently available. This includes Flex 2, 3, 4, AIR 1 and 2, Flash Lite, and of course the Flash Authoring tool" 15 | s.rubyforge_project = "sprout" 16 | s.required_rubygems_version = ">= 1.3.6" 17 | s.require_path = "sprout/lib" 18 | s.files = FileList["**/*"].exclude /docs|.DS_Store|generated|.svn|.git|airglobal.swc|airframework.swc/ 19 | end 20 | 21 | -------------------------------------------------------------------------------- /asunit-4.0/docs/presentation/WhatsNew.key: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patternpark/asunit/5bc790908714801e4fa16badd43d232b4200a60d/asunit-4.0/docs/presentation/WhatsNew.key -------------------------------------------------------------------------------- /asunit-4.0/lib/Reflection.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patternpark/asunit/5bc790908714801e4fa16badd43d232b4200a60d/asunit-4.0/lib/Reflection.swc -------------------------------------------------------------------------------- /asunit-4.0/lib/SwiftSuspenders-v1.5.1.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patternpark/asunit/5bc790908714801e4fa16badd43d232b4200a60d/asunit-4.0/lib/SwiftSuspenders-v1.5.1.swc -------------------------------------------------------------------------------- /asunit-4.0/lib/airframework.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patternpark/asunit/5bc790908714801e4fa16badd43d232b4200a60d/asunit-4.0/lib/airframework.swc -------------------------------------------------------------------------------- /asunit-4.0/lib/airglobal.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patternpark/asunit/5bc790908714801e4fa16badd43d232b4200a60d/asunit-4.0/lib/airglobal.swc -------------------------------------------------------------------------------- /asunit-4.0/lib/flexUnitTasks.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patternpark/asunit/5bc790908714801e4fa16badd43d232b4200a60d/asunit-4.0/lib/flexUnitTasks.jar -------------------------------------------------------------------------------- /asunit-4.0/sprout/lib/asunit4.rb: -------------------------------------------------------------------------------- 1 | require 'flashsdk' 2 | 3 | $:.unshift File.dirname(__FILE__) 4 | 5 | module AsUnit 6 | NAME = 'asunit4' 7 | VERSION = '4.2.3.pre' 8 | end 9 | 10 | require 'asunit4/test_class_generator' 11 | require 'asunit4/suite_class_generator' 12 | 13 | Sprout::Specification.new do |s| 14 | s.name = AsUnit::NAME 15 | s.version = AsUnit::VERSION 16 | s.add_file_target do |f| 17 | f.add_library :swc, File.join('..', '..', 'bin', "AsUnit-#{AsUnit::VERSION}.swc") 18 | # Removed the src compilation for now, b/c it requires additional compiler 19 | # configuration - like keep-as3-metadata... 20 | #f.add_library :src, [File.join(path, 'src'), File.join(path, 'vendor/as3reflection')] 21 | end 22 | end 23 | 24 | -------------------------------------------------------------------------------- /asunit-4.0/sprout/lib/asunit4/suite_class_generator.rb: -------------------------------------------------------------------------------- 1 | module AsUnit4 2 | class SuiteClassGenerator < FlashSDK::ClassGenerator 3 | include FlashSDK::FlashHelper 4 | 5 | def initialize 6 | super 7 | self.input = 'AllTests.as' 8 | end 9 | 10 | def manifest 11 | directory test do 12 | template input, 'AsUnit4SuiteClass.as' 13 | end 14 | end 15 | end 16 | end 17 | 18 | -------------------------------------------------------------------------------- /asunit-4.0/sprout/lib/asunit4/templates/AsUnit4SuiteClass.as: -------------------------------------------------------------------------------- 1 | package { 2 | /** 3 | * This file has been automatically created using 4 | * #!/usr/bin/ruby script/generate suite 5 | * If you modify it and run this script, your 6 | * modifications will be lost! 7 | */ 8 | <% test_case_classes.each do |test_case| %>import <%= test_case %>; 9 | <% end %> 10 | 11 | [Suite] 12 | public class AllTests { 13 | <% test_case_classes.each do |test_case| %>public var <%= test_case.gsub('.', '_') %>:<%= test_case %>; 14 | <% end %> 15 | 16 | } 17 | } 18 | 19 | -------------------------------------------------------------------------------- /asunit-4.0/sprout/lib/asunit4/templates/AsUnit4TestClass.as: -------------------------------------------------------------------------------- 1 | package <%= package_name %> { 2 | 3 | import asunit.asserts.*; 4 | import asunit.framework.IAsync; 5 | import flash.display.Sprite; 6 | 7 | public class <%= test_class_name %> { 8 | 9 | [Inject] 10 | public var async:IAsync; 11 | 12 | [Inject] 13 | public var context:Sprite; 14 | 15 | private var <%= instance_name %>:<%= class_name %>; 16 | 17 | [Before] 18 | public function setUp():void { 19 | <%= instance_name %> = new <%= class_name %>(); 20 | } 21 | 22 | [After] 23 | public function tearDown():void { 24 | <%= instance_name %> = null; 25 | } 26 | 27 | [Test] 28 | public function shouldBeInstantiated():void { 29 | assertTrue("<%= instance_name %> is <%= class_name %>", <%= instance_name %> is <%= class_name %>); 30 | } 31 | } 32 | } 33 | 34 | -------------------------------------------------------------------------------- /asunit-4.0/sprout/lib/asunit4/test_class_generator.rb: -------------------------------------------------------------------------------- 1 | 2 | module AsUnit4 3 | class TestClassGenerator < FlashSDK::ClassGenerator 4 | 5 | def manifest 6 | directory test_class_directory do 7 | template "#{test_class_name}.as", 'AsUnit4TestClass.as' 8 | end 9 | 10 | generator :suite_class, {:input => 'AllTests.as'} 11 | end 12 | 13 | end 14 | end 15 | 16 | -------------------------------------------------------------------------------- /asunit-4.0/sprout/test/unit/test_class_generator_test.rb: -------------------------------------------------------------------------------- 1 | require File.join(File.dirname(__FILE__), "test_helper") 2 | 3 | class TestClassGeneratorTest < Test::Unit::TestCase 4 | include SproutTestCase 5 | 6 | context "a new test class generator" do 7 | 8 | setup do 9 | @fixtures = File.join('sprout', 'test', 'fixtures') 10 | @temp = File.join(fixtures, 'tmp') 11 | FileUtils.mkdir_p @temp 12 | 13 | @generator = AsUnit4::TestClassGenerator.new 14 | @generator.path = @temp 15 | @generator.logger = StringIO.new 16 | end 17 | 18 | teardown do 19 | remove_file @temp 20 | end 21 | 22 | should "work with a simple class" do 23 | @generator.input = 'utils.MathUtilTest' 24 | @generator.execute 25 | 26 | assert_file File.join(@temp, 'test', 'utils', 'MathUtilTest.as') do |content| 27 | assert_matches /class MathUtilTest \{/, content 28 | assert_matches /private var .*:MathUtil;/, content 29 | assert_matches /new MathUtil\(\);/, content 30 | end 31 | assert_file File.join(@temp, 'test', 'AllTests.as') do |content| 32 | assert_matches /import utils.MathUtilTest;/, content 33 | assert_matches /public var utils_MathUtilTest:utils\.MathUtilTest;/, content 34 | end 35 | end 36 | 37 | should "work without test suffix in the request" do 38 | @generator.input = 'utils.MathUtil' 39 | @generator.execute 40 | assert_file File.join(@temp, 'test', 'utils', 'MathUtilTest.as') do |content| 41 | assert_matches /class MathUtilTest \{/, content 42 | assert_matches /private var instance:MathUtil/, content 43 | end 44 | assert_file File.join(@temp, 'test', 'AllTests.as') do |content| 45 | assert_matches /import utils.MathUtilTest/, content 46 | assert_matches /public var utils_MathUtilTest:utils\.MathUtilTest;/, content 47 | end 48 | end 49 | end 50 | end 51 | 52 | -------------------------------------------------------------------------------- /asunit-4.0/sprout/test/unit/test_helper.rb: -------------------------------------------------------------------------------- 1 | require "rubygems" 2 | require "bundler" 3 | 4 | Bundler.require :default, :development 5 | 6 | # These require statments *must* be in this order: 7 | # http://bit.ly/bCC0Ew 8 | # Somewhat surprised they're not being required by Bundler... 9 | require 'shoulda' 10 | require 'mocha' 11 | require 'test/unit' 12 | 13 | require File.join(File.dirname(__FILE__), '..', '..', 'lib', 'asunit4') 14 | $:.unshift File.dirname(__FILE__) 15 | 16 | require 'sprout/test/sprout_test_case' 17 | 18 | -------------------------------------------------------------------------------- /asunit-4.0/src/asunit/asserts/assertEquals.as: -------------------------------------------------------------------------------- 1 | package asunit.asserts { 2 | import asunit.framework.Assert; 3 | 4 | public const assertEquals:Function = Assert.assertEquals; 5 | } 6 | -------------------------------------------------------------------------------- /asunit-4.0/src/asunit/asserts/assertEqualsArrays.as: -------------------------------------------------------------------------------- 1 | package asunit.asserts { 2 | import asunit.framework.Assert; 3 | 4 | public var assertEqualsArrays:Function = Assert.assertEqualsArrays; 5 | } 6 | -------------------------------------------------------------------------------- /asunit-4.0/src/asunit/asserts/assertEqualsArraysIgnoringOrder.as: -------------------------------------------------------------------------------- 1 | package asunit.asserts { 2 | import asunit.framework.Assert; 3 | 4 | public var assertEqualsArraysIgnoringOrder:Function = Assert.assertEqualsArraysIgnoringOrder; 5 | } 6 | -------------------------------------------------------------------------------- /asunit-4.0/src/asunit/asserts/assertEqualsFloat.as: -------------------------------------------------------------------------------- 1 | package asunit.asserts { 2 | import asunit.framework.Assert; 3 | 4 | public var assertEqualsFloat:Function = Assert.assertEqualsFloat; 5 | } 6 | -------------------------------------------------------------------------------- /asunit-4.0/src/asunit/asserts/assertFalse.as: -------------------------------------------------------------------------------- 1 | package asunit.asserts { 2 | import asunit.framework.Assert; 3 | 4 | public var assertFalse:Function = Assert.assertFalse; 5 | } 6 | -------------------------------------------------------------------------------- /asunit-4.0/src/asunit/asserts/assertMatches.as: -------------------------------------------------------------------------------- 1 | 2 | package asunit.asserts { 3 | import asunit.framework.Assert; 4 | 5 | public const assertMatches:Function = Assert.assertMatches; 6 | } 7 | -------------------------------------------------------------------------------- /asunit-4.0/src/asunit/asserts/assertNotNull.as: -------------------------------------------------------------------------------- 1 | package asunit.asserts { 2 | import asunit.framework.Assert; 3 | 4 | public var assertNotNull:Function = Assert.assertNotNull; 5 | } 6 | -------------------------------------------------------------------------------- /asunit-4.0/src/asunit/asserts/assertNotSame.as: -------------------------------------------------------------------------------- 1 | package asunit.asserts { 2 | import asunit.framework.Assert; 3 | 4 | public var assertNotSame:Function = Assert.assertNotSame; 5 | } 6 | -------------------------------------------------------------------------------- /asunit-4.0/src/asunit/asserts/assertNull.as: -------------------------------------------------------------------------------- 1 | package asunit.asserts { 2 | import asunit.framework.Assert; 3 | 4 | public var assertNull:Function = Assert.assertNull; 5 | } 6 | -------------------------------------------------------------------------------- /asunit-4.0/src/asunit/asserts/assertSame.as: -------------------------------------------------------------------------------- 1 | package asunit.asserts { 2 | import asunit.framework.Assert; 3 | 4 | public var assertSame:Function = Assert.assertSame; 5 | } 6 | -------------------------------------------------------------------------------- /asunit-4.0/src/asunit/asserts/assertThrows.as: -------------------------------------------------------------------------------- 1 | package asunit.asserts { 2 | import asunit.framework.Assert; 3 | 4 | public var assertThrows:Function = Assert.assertThrows; 5 | } 6 | -------------------------------------------------------------------------------- /asunit-4.0/src/asunit/asserts/assertThrowsWithMessage.as: -------------------------------------------------------------------------------- 1 | package asunit.asserts { 2 | import asunit.framework.Assert; 3 | 4 | public var assertThrowsWithMessage:Function = Assert.assertThrowsWithMessage; 5 | } 6 | -------------------------------------------------------------------------------- /asunit-4.0/src/asunit/asserts/assertTrue.as: -------------------------------------------------------------------------------- 1 | package asunit.asserts { 2 | import asunit.framework.Assert; 3 | 4 | public var assertTrue:Function = Assert.assertTrue; 5 | } 6 | -------------------------------------------------------------------------------- /asunit-4.0/src/asunit/asserts/fail.as: -------------------------------------------------------------------------------- 1 | package asunit.asserts { 2 | import asunit.framework.Assert; 3 | 4 | public const fail:Function = Assert.fail; 5 | } 6 | -------------------------------------------------------------------------------- /asunit-4.0/src/asunit/core/FlashBuilderCore.as: -------------------------------------------------------------------------------- 1 | package asunit.core { 2 | 3 | import asunit.printers.FlashBuilderPrinter; 4 | 5 | import flash.system.fscommand; 6 | 7 | public class FlashBuilderCore extends TextCore { 8 | 9 | override protected function initializeObservers():void { 10 | super.initializeObservers(); 11 | var projectName:String = 'SomeProject'; 12 | addListener(new FlashBuilderPrinter(projectName)); 13 | } 14 | 15 | override protected function onRunCompleted():void { 16 | super.onRunCompleted(); 17 | fscommand('quit'); // fails silently if not in debug player 18 | //System.exit(0); // generates SecurityError if not in debug player 19 | } 20 | } 21 | } 22 | 23 | -------------------------------------------------------------------------------- /asunit-4.0/src/asunit/core/FlashDevelopCore.as: -------------------------------------------------------------------------------- 1 | package asunit.core { 2 | 3 | import asunit.printers.FlashDevelopPrinter; 4 | 5 | import flash.system.fscommand; 6 | 7 | public class FlashDevelopCore extends TextCore { 8 | 9 | override protected function initializeObservers():void { 10 | super.initializeObservers(); 11 | addListener(new FlashDevelopPrinter()); 12 | } 13 | 14 | override protected function onRunCompleted():void { 15 | super.onRunCompleted(); 16 | fscommand('quit'); // fails silently if not in debug player 17 | //System.exit(0); // generates SecurityError if not in debug player 18 | } 19 | } 20 | } 21 | 22 | -------------------------------------------------------------------------------- /asunit-4.0/src/asunit/core/FlexUnitCICore.as: -------------------------------------------------------------------------------- 1 | package asunit.core { 2 | 3 | import asunit.printers.FlexUnitCIPrinter; 4 | 5 | public class FlexUnitCICore extends TextCore { 6 | 7 | override protected function initializeObservers():void { 8 | super.initializeObservers(); 9 | addListener(new FlexUnitCIPrinter()); 10 | } 11 | 12 | override protected function onRunCompleted():void { 13 | super.onRunCompleted(); 14 | // The FlexUnitCIPrinter will close Flash Player when the socket acknowledges the end. 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /asunit-4.0/src/asunit/core/TextCore.as: -------------------------------------------------------------------------------- 1 | package asunit.core { 2 | 3 | import asunit.printers.ColorTracePrinter; 4 | import asunit.printers.TextPrinter; 5 | 6 | import flash.display.DisplayObjectContainer; 7 | 8 | /** 9 | * TextCore is just a simple helper class that 10 | * configures the base class AsUnitCore to use the 11 | * standard TextPrinter. 12 | * 13 | * The main idea is that you may want a completely 14 | * different text output without the default TextPrinter, 15 | * and if that's the case, you can go ahead and 16 | * instantiate AsUnitCore and configure it however you 17 | * wish. 18 | */ 19 | public class TextCore extends AsUnitCore { 20 | 21 | public var textPrinter:TextPrinter; 22 | 23 | override protected function initializeObservers():void { 24 | super.initializeObservers(); 25 | 26 | textPrinter = new TextPrinter(); 27 | textPrinter.traceOnComplete = false; 28 | addListener(textPrinter); 29 | 30 | addListener(new ColorTracePrinter()); 31 | } 32 | 33 | override public function set visualContext(context:DisplayObjectContainer):void { 34 | super.visualContext = context; 35 | // Add the TextPrinter to the Display List: 36 | visualContext.addChild(textPrinter); 37 | } 38 | } 39 | } 40 | 41 | -------------------------------------------------------------------------------- /asunit-4.0/src/asunit/errors/AbstractError.as: -------------------------------------------------------------------------------- 1 | package asunit.errors { 2 | 3 | public class AbstractError extends Error { 4 | 5 | public function AbstractError(message:String) { 6 | super(message); 7 | name = "AbstractError"; 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /asunit-4.0/src/asunit/errors/AssertionFailedError.as: -------------------------------------------------------------------------------- 1 | package asunit.errors { 2 | 3 | public class AssertionFailedError extends Error { 4 | 5 | public function AssertionFailedError(message:String) { 6 | super(message); 7 | name = "AssertionFailedError"; 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /asunit-4.0/src/asunit/errors/ClassNotFoundError.as: -------------------------------------------------------------------------------- 1 | package asunit.errors { 2 | 3 | public class ClassNotFoundError extends Error { 4 | 5 | public function ClassNotFoundError(message:String) { 6 | super(message); 7 | name = "ClassNotFoundError"; 8 | } 9 | } 10 | } 11 | 12 | -------------------------------------------------------------------------------- /asunit-4.0/src/asunit/errors/InstanceNotFoundError.as: -------------------------------------------------------------------------------- 1 | package asunit.errors { 2 | 3 | public class InstanceNotFoundError extends Error { 4 | 5 | public function InstanceNotFoundError(message:String) { 6 | super(message); 7 | name = "InstanceNotFoundError"; 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /asunit-4.0/src/asunit/errors/UnimplementedFeatureError.as: -------------------------------------------------------------------------------- 1 | package asunit.errors { 2 | 3 | public class UnimplementedFeatureError extends Error { 4 | 5 | public function UnimplementedFeatureError(message:String) { 6 | super(message); 7 | name = "UnimplementedFeatureError"; 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /asunit-4.0/src/asunit/errors/UsageError.as: -------------------------------------------------------------------------------- 1 | package asunit.errors { 2 | 3 | public class UsageError extends Error { 4 | 5 | public function UsageError(message:String) { 6 | super(message); 7 | name = "UsageError"; 8 | } 9 | } 10 | } 11 | 12 | -------------------------------------------------------------------------------- /asunit-4.0/src/asunit/events/TimeoutCommandEvent.as: -------------------------------------------------------------------------------- 1 | package asunit.events { 2 | 3 | import asunit.framework.TimeoutCommand; 4 | 5 | import flash.events.Event; 6 | 7 | public class TimeoutCommandEvent extends Event { 8 | public static const ADDED:String = 'added'; 9 | public static const CALLED:String = 'called'; 10 | public static const TIMED_OUT:String = 'timedOut'; 11 | 12 | public var command:TimeoutCommand; 13 | 14 | public function TimeoutCommandEvent(type:String, command:TimeoutCommand, bubbles:Boolean=false, cancelable:Boolean=false) { 15 | super(type, bubbles, cancelable); 16 | this.command = command; 17 | } 18 | 19 | public override function clone():Event { 20 | return new TimeoutCommandEvent(type, command, bubbles, cancelable); 21 | } 22 | 23 | public override function toString():String { 24 | return formatToString("TimeoutCommandEvent", "command", "type", "bubbles", "cancelable", "eventPhase"); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /asunit-4.0/src/asunit/framework/Command.as: -------------------------------------------------------------------------------- 1 | package asunit.framework { 2 | 3 | public interface Command { 4 | function execute():*; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /asunit-4.0/src/asunit/framework/ErrorEvent.as: -------------------------------------------------------------------------------- 1 | package asunit.framework { 2 | 3 | import flash.events.Event; 4 | 5 | public class ErrorEvent extends Event { 6 | public static const ERROR:String = 'error'; 7 | protected var _error:Error; 8 | 9 | public function ErrorEvent(type:String, error:Error) { 10 | super(type); 11 | this._error = error; 12 | } 13 | 14 | override public function clone():Event { 15 | return new ErrorEvent(type, _error); 16 | } 17 | 18 | public function get error():Error { return _error; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /asunit-4.0/src/asunit/framework/IAsync.as: -------------------------------------------------------------------------------- 1 | package asunit.framework { 2 | 3 | import flash.events.IEventDispatcher; 4 | 5 | public interface IAsync extends IEventDispatcher { 6 | 7 | function set timeout(timeout:int):void; 8 | function get timeout():int; 9 | 10 | function add(handler:Function=null, duration:int=-1):Function; 11 | 12 | function cancelPending():void; 13 | 14 | function get hasPending():Boolean; 15 | 16 | function getPending():Array; 17 | 18 | function proceedOnEvent(target:IEventDispatcher, eventName:String, timeout:int = 500, timeoutHandler:Function = null):void; 19 | } 20 | } 21 | 22 | -------------------------------------------------------------------------------- /asunit-4.0/src/asunit/framework/IResult.as: -------------------------------------------------------------------------------- 1 | package asunit.framework { 2 | 3 | public interface IResult extends IRunListener, ITestListener { 4 | 5 | function addListener(listener:IRunListener):void; 6 | function removeListener(listener:IRunListener):void; 7 | 8 | function get errors():Array; 9 | function get errorCount():uint; 10 | 11 | function get failures():Array; 12 | function get failureCount():uint; 13 | 14 | function get successes():Array; 15 | function get successCount():uint; 16 | 17 | function get warnings():Array; 18 | 19 | function get ignoredTests():Array; 20 | function get ignoredTestCount():uint; 21 | 22 | function get runCount():uint; 23 | 24 | function get failureEncountered():Boolean; 25 | function get wasSuccessful():Boolean; 26 | 27 | function get runTime():Number; 28 | function set runTime(value:Number):void; 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /asunit-4.0/src/asunit/framework/IRunListener.as: -------------------------------------------------------------------------------- 1 | package asunit.framework { 2 | 3 | public interface IRunListener extends ITestListener { 4 | function onRunStarted():void; 5 | function onRunCompleted(result:IResult):void; 6 | } 7 | } 8 | 9 | -------------------------------------------------------------------------------- /asunit-4.0/src/asunit/framework/IRunner.as: -------------------------------------------------------------------------------- 1 | package asunit.framework { 2 | 3 | import flash.events.IEventDispatcher; 4 | import flash.display.DisplayObjectContainer; 5 | 6 | public interface IRunner extends IEventDispatcher { 7 | 8 | function run(testOrSuite:Class, testMethodName:String=null, visualContext:DisplayObjectContainer=null):void; 9 | 10 | } 11 | } 12 | 13 | -------------------------------------------------------------------------------- /asunit-4.0/src/asunit/framework/IRunnerFactory.as: -------------------------------------------------------------------------------- 1 | package asunit.framework { 2 | import org.swiftsuspenders.Injector; 3 | 4 | public interface IRunnerFactory { 5 | function get injector():Injector; 6 | function set injector(value:Injector):void; 7 | function runnerFor(testOrSuite:Class):IRunner; 8 | } 9 | } -------------------------------------------------------------------------------- /asunit-4.0/src/asunit/framework/ITestFailure.as: -------------------------------------------------------------------------------- 1 | package asunit.framework 2 | { 3 | 4 | /** 5 | * 6 | */ 7 | public interface ITestFailure { 8 | 9 | function get failedFeature():String; 10 | 11 | function get failedMethod():String; 12 | 13 | /** 14 | * Gets the failed test case. 15 | */ 16 | function get failedTest():Object; 17 | 18 | /** 19 | * Gets the thrown exception. 20 | */ 21 | function get thrownException():Error; 22 | 23 | function get exceptionMessage():String; 24 | 25 | function get isFailure():Boolean; 26 | 27 | /** 28 | * Returns a short description of the failure. 29 | */ 30 | function toString():String; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /asunit-4.0/src/asunit/framework/ITestListener.as: -------------------------------------------------------------------------------- 1 | package asunit.framework { 2 | 3 | import asunit.framework.ITestFailure; 4 | 5 | public interface ITestListener { 6 | function onTestStarted(test:Object):void; 7 | function onTestCompleted(test:Object):void; 8 | function onTestFailure(failure:ITestFailure):void; 9 | function onTestSuccess(success:ITestSuccess):void; 10 | function onTestIgnored(method:Method):void; 11 | function onWarning(warning:ITestWarning):void; 12 | } 13 | } 14 | 15 | -------------------------------------------------------------------------------- /asunit-4.0/src/asunit/framework/ITestSuccess.as: -------------------------------------------------------------------------------- 1 | package asunit.framework { 2 | 3 | /** 4 | * 5 | */ 6 | public interface ITestSuccess { 7 | 8 | /** 9 | * Gets the test case. 10 | */ 11 | function get test():Object; 12 | 13 | function get method():String; 14 | 15 | function get feature():String; 16 | 17 | /** 18 | * Returns a short description of the failure. 19 | */ 20 | function toString():String; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /asunit-4.0/src/asunit/framework/ITestWarning.as: -------------------------------------------------------------------------------- 1 | package asunit.framework { 2 | 3 | public interface ITestWarning { 4 | 5 | function set message(message:String):void; 6 | function get message():String; 7 | 8 | function set method(method:Method):void; 9 | function get method():Method; 10 | 11 | function toString():String; 12 | } 13 | } 14 | 15 | -------------------------------------------------------------------------------- /asunit-4.0/src/asunit/framework/LegacyTestIterator.as: -------------------------------------------------------------------------------- 1 | package asunit.framework { 2 | 3 | import p2.reflect.Reflection; 4 | import p2.reflect.ReflectionMethod; 5 | 6 | public class LegacyTestIterator extends TestIterator { 7 | 8 | public function LegacyTestIterator(test:Object, testMethodName:String = "") { 9 | super(test, testMethodName); 10 | } 11 | 12 | override protected function getTestMethods(test:Object):Array { 13 | var annotatedMethods:Array = super.getTestMethods(test); 14 | var namedMethods:Array = getTestMethodsByName(test); 15 | return annotatedMethods.concat(namedMethods); 16 | } 17 | 18 | protected function getTestMethodsByName(instance:Object):Array { 19 | var methods:Array = []; 20 | var reflection:Reflection = Reflection.create(instance); 21 | reflection.methods.forEach(function(methodReflection:ReflectionMethod, index:int, list:Array):void { 22 | if(methodNameBeginsWithTest(methodReflection) && methodDoesNotHaveTestAnnotation(methodReflection)) { 23 | methods.push( new Method(instance, methodReflection) ); 24 | } 25 | }); 26 | 27 | methods.sortOn('name'); 28 | return methods; 29 | } 30 | 31 | protected function methodNameBeginsWithTest(method:ReflectionMethod):Boolean { 32 | return (method.name.match(/^test/) != null); 33 | } 34 | 35 | protected function methodDoesNotHaveTestAnnotation(method:ReflectionMethod):Boolean { 36 | return (method.getMetaDataByName('Test') == null); 37 | } 38 | } 39 | } 40 | 41 | -------------------------------------------------------------------------------- /asunit-4.0/src/asunit/framework/TestSuccess.as: -------------------------------------------------------------------------------- 1 | package asunit.framework { 2 | import flash.utils.getQualifiedClassName; 3 | 4 | /** 5 | * @see Result 6 | */ 7 | public class TestSuccess implements ITestSuccess { 8 | protected var _test:Object; 9 | protected var _method:String; 10 | 11 | /** 12 | * Constructs a TestFailure with the given test and exception. 13 | */ 14 | public function TestSuccess(test:Object, method:String) { 15 | _test = test; 16 | _method = method; 17 | } 18 | 19 | public function get feature():String { 20 | return getQualifiedClassName(_test) + '.' + _method; 21 | } 22 | 23 | public function get test():Object { 24 | return _test; 25 | } 26 | 27 | public function get method():String { 28 | return _method; 29 | } 30 | 31 | /** 32 | * Returns a short description of the success. 33 | */ 34 | public function toString():String { 35 | return "[TestSuccess " + method + "]"; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /asunit-4.0/src/asunit/framework/TestWarning.as: -------------------------------------------------------------------------------- 1 | package asunit.framework { 2 | 3 | public class TestWarning implements ITestWarning { 4 | 5 | private var _message:String; 6 | private var _method:Method; 7 | 8 | public function TestWarning(message:String, method:Method=null) { 9 | _message = message; 10 | _method = method; 11 | } 12 | 13 | public function set message(message:String):void { 14 | _message = message; 15 | } 16 | 17 | public function get message():String { 18 | return _message; 19 | } 20 | 21 | public function set method(method:Method):void { 22 | _method = method; 23 | } 24 | 25 | public function get method():Method { 26 | return _method; 27 | } 28 | 29 | public function toString():String { 30 | if(method) { 31 | return "[WARNING] " + method + " : " + message; 32 | } 33 | else { 34 | return "[WARNING] " + message; 35 | } 36 | } 37 | } 38 | } 39 | 40 | 41 | -------------------------------------------------------------------------------- /asunit-4.0/src/asunit/runners/LegacyRunner.as: -------------------------------------------------------------------------------- 1 | package asunit.runners { 2 | 3 | import asunit.framework.IResult; 4 | import asunit.framework.LegacyTestIterator; 5 | import asunit.framework.TestIterator; 6 | 7 | public class LegacyRunner extends TestRunner { 8 | 9 | public function LegacyRunner(result:IResult = null) { 10 | super(result); 11 | } 12 | 13 | override protected function createTestIterator(test:*, testMethodName:String):TestIterator { 14 | return new LegacyTestIterator(test, testMethodName); 15 | } 16 | } 17 | } 18 | 19 | -------------------------------------------------------------------------------- /asunit-4.0/src/asunit/util/ArrayIterator.as: -------------------------------------------------------------------------------- 1 | package asunit.util { 2 | 3 | import asunit.util.Iterator; 4 | 5 | [ExcludeClass] 6 | public class ArrayIterator implements Iterator { 7 | private var items:Array; 8 | private var index:Number = 0; 9 | 10 | public function ArrayIterator(items:Array=null) { 11 | this.items = items || []; 12 | } 13 | 14 | public function hasNext():Boolean { 15 | return items[index] != null; 16 | } 17 | 18 | public function next():* { 19 | return items[index++]; 20 | } 21 | 22 | public function get length():uint { 23 | return items.length; 24 | } 25 | 26 | public function reset():void { 27 | index = 0; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /asunit-4.0/src/asunit/util/Iterator.as: -------------------------------------------------------------------------------- 1 | package asunit.util { 2 | 3 | [ExcludeClass] 4 | public interface Iterator { 5 | function next():*; 6 | function hasNext():Boolean; 7 | function reset():void; 8 | function get length():uint; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /asunit-4.0/test/AsUnitCIRunner.as: -------------------------------------------------------------------------------- 1 | package { 2 | 3 | import asunit.core.FlexUnitCICore; 4 | import asunit.core.TextCore; 5 | 6 | import flash.display.MovieClip; 7 | 8 | [SWF(width="1024", height="640", backgroundColor="#000000", frameRate="61")] 9 | public class AsUnitCIRunner extends MovieClip { 10 | 11 | private var core:TextCore; 12 | 13 | public function AsUnitCIRunner() { 14 | core = new FlexUnitCICore(); 15 | core.start(AllTests, null, this); 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /asunit-4.0/test/AsUnitRunner.as: -------------------------------------------------------------------------------- 1 | package { 2 | 3 | import asunit.core.TextCore; 4 | import flash.display.MovieClip; 5 | 6 | [SWF(width="1024", height="640", backgroundColor="#000000", frameRate="61")] 7 | public class AsUnitRunner extends MovieClip { 8 | 9 | private var core:TextCore; 10 | 11 | public function AsUnitRunner() { 12 | core = new TextCore(); 13 | core.textPrinter.hideLocalPaths = true; 14 | core.start(AllTests, null, this); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /asunit-4.0/test/AsUnitRunnerCS3.fla: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patternpark/asunit/5bc790908714801e4fa16badd43d232b4200a60d/asunit-4.0/test/AsUnitRunnerCS3.fla -------------------------------------------------------------------------------- /asunit-4.0/test/Flex3Runner.mxml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /asunit-4.0/test/Flex4Runner.mxml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /asunit-4.0/test/asunit/framework/AssertThrowsTest.as: -------------------------------------------------------------------------------- 1 | package asunit.framework { 2 | 3 | import asunit.asserts.*; 4 | import asunit.errors.AssertionFailedError; 5 | 6 | public class AssertThrowsTest { 7 | 8 | [Test] 9 | public function throwingExpectedErrorShouldPass():void { 10 | assertThrows(ArgumentError, function():void { throw new ArgumentError(); } ); 11 | } 12 | 13 | [Test] 14 | public function throwingUnexpectedErrorShouldFailWithMessage():void { 15 | try { 16 | assertThrows(ArgumentError, function():void { throw new Error("wrong error type"); } ); 17 | } 18 | catch (e:AssertionFailedError) { 19 | assertEquals("expected error type: but was:", e.message) 20 | return; 21 | } 22 | fail('failed assertThrows() should have thrown AssertionFailedError'); 23 | } 24 | 25 | /** 26 | * Captures a bug in original assertThrows implementation 27 | * where the message when nothing was thrown said "but was:". 28 | */ 29 | [Test] 30 | public function throwingNoErrorShouldFailWithMessage():void { 31 | try { 32 | assertThrows(ArgumentError, function():void { } ); 33 | } 34 | catch (e:AssertionFailedError) { 35 | assertEquals("expected error type: but none was thrown.", e.message) 36 | return; 37 | } 38 | fail('failed assertThrows() should have thrown AssertionFailedError'); 39 | } 40 | } 41 | } 42 | 43 | -------------------------------------------------------------------------------- /asunit-4.0/test/asunit/framework/AssertThrowsWithMessageTest.as: -------------------------------------------------------------------------------- 1 | package asunit.framework { 2 | 3 | import asunit.asserts.*; 4 | import asunit.errors.AssertionFailedError; 5 | 6 | public class AssertThrowsWithMessageTest { 7 | 8 | [Test] 9 | public function throwingExpectedErrorShouldPass():void { 10 | assertThrowsWithMessage(ArgumentError, "foo", function():void { throw new ArgumentError("foo"); } ); 11 | } 12 | 13 | [Test] 14 | public function throwingUnexpectedErrorShouldFail():void { 15 | try { 16 | assertThrowsWithMessage(ArgumentError, "wrong error type", function():void { throw new Error("wrong error type"); } ); 17 | } 18 | catch (e:AssertionFailedError) { 19 | assertEquals("expected error type: but was:", e.message) 20 | return; 21 | } 22 | fail('failed assertThrowsWithMessage() should have thrown AssertionFailedError'); 23 | } 24 | 25 | [Test] 26 | public function throwingNoErrorShouldFailWithMessage():void { 27 | try { 28 | assertThrowsWithMessage(ArgumentError, "foo", function():void { } ); 29 | } 30 | catch (e:AssertionFailedError) { 31 | assertEquals("expected error type: with message: but none was thrown.", e.message) 32 | return; 33 | } 34 | fail('failed assertThrowsWithMessage() should have thrown AssertionFailedError'); 35 | } 36 | 37 | [Test] 38 | public function throwingErrorWithUnexpectedMessageShouldFail():void { 39 | try { 40 | assertThrowsWithMessage(Error, "foo", function():void { throw new Error("bar"); } ); 41 | } 42 | catch (e:AssertionFailedError) { 43 | assertEquals("expected error message: but was:", e.message) 44 | return; 45 | } 46 | fail('failed assertThrowsWithMessage() should have thrown AssertionFailedError'); 47 | } 48 | } 49 | } 50 | 51 | -------------------------------------------------------------------------------- /asunit-4.0/test/asunit/framework/MockData.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /asunit-4.0/test/asunit/framework/NestedSuiteIteratorTest.as: -------------------------------------------------------------------------------- 1 | package asunit.framework { 2 | 3 | import asunit.framework.TestCase; 4 | 5 | import asunit.support.FailAssertEquals; 6 | import asunit.support.FailAssertTrue; 7 | import asunit.support.SucceedAssertTrue; 8 | import asunit.support.SuiteOfTwoSuites; 9 | 10 | public class NestedSuiteIteratorTest extends TestCase { 11 | private var iterator:SuiteIterator; 12 | private var suiteClass:Class; 13 | 14 | public function NestedSuiteIteratorTest(testMethod:String = null) { 15 | super(testMethod); 16 | } 17 | 18 | protected override function setUp():void { 19 | suiteClass = SuiteOfTwoSuites; 20 | } 21 | 22 | protected override function tearDown():void { 23 | iterator = null; 24 | } 25 | 26 | public function test_length_from_SuiteIterator():void { 27 | var iterator:SuiteIterator = new SuiteIterator(suiteClass); 28 | assertEquals(3, iterator.length); 29 | } 30 | 31 | public function test_isSuite_false_with_test_class():void { 32 | var iterator:SuiteIterator = new SuiteIterator(SucceedAssertTrue); 33 | assertEquals(1, iterator.length); 34 | } 35 | 36 | public function test_getTestClasses_of_suite_class():void { 37 | var iterator:SuiteIterator = new SuiteIterator(suiteClass); 38 | assertEquals(3, iterator.length); 39 | assertSame(FailAssertEquals, iterator.next()); 40 | assertSame(FailAssertTrue, iterator.next()); 41 | assertSame(SucceedAssertTrue, iterator.next()); 42 | } 43 | 44 | public function test_iterator_for_suite_class_with_2_nested_suites_hasNext():void { 45 | iterator = new SuiteIterator(suiteClass); 46 | assertTrue(iterator.hasNext()); 47 | } 48 | 49 | public function test_iterator_next():void { 50 | iterator = new SuiteIterator(suiteClass); 51 | 52 | assertSame(FailAssertEquals, iterator.next()); 53 | assertSame(FailAssertTrue, iterator.next()); 54 | assertSame(SucceedAssertTrue, iterator.next()); 55 | 56 | assertFalse('no methods left in iterator', iterator.hasNext()); 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /asunit-4.0/test/asunit/framework/ResultObserverTest.as: -------------------------------------------------------------------------------- 1 | package asunit.framework { 2 | 3 | import asunit.asserts.*; 4 | import asunit.support.FakeObserver; 5 | import asunit.framework.Result; 6 | 7 | public class ResultObserverTest { 8 | 9 | private var result:Result; 10 | 11 | private var listener:FakeObserver; 12 | 13 | [Before] 14 | public function createObserver():void { 15 | listener = new FakeObserver(); 16 | result = new Result(); 17 | result.addListener(listener); 18 | } 19 | 20 | [After] 21 | public function destroyObserver():void { 22 | listener = null; 23 | } 24 | 25 | [Test] 26 | public function canInstantiate():void { 27 | assertTrue("instance is Result", result is Result); 28 | } 29 | 30 | [Test] 31 | public function addedListenerReceivesOnRunStarted():void { 32 | result.onRunStarted(); 33 | assertTrue(listener.onRunStartedCalled); 34 | } 35 | 36 | [Test] 37 | public function addedListenerReceivesOnTestStarted():void { 38 | result.onTestStarted(null); 39 | assertTrue(listener.onTestStartedCalled); 40 | } 41 | 42 | [Test] 43 | public function shouldHaveDefaultRunCount():void 44 | { 45 | assertEquals(0, result.runCount); 46 | } 47 | 48 | [Test] 49 | public function shouldHaveCumulativeRunCount():void 50 | { 51 | result.onTestStarted(null); 52 | result.onTestSuccess(null); 53 | result.onTestCompleted(null); 54 | result.onTestStarted(null); 55 | result.onTestSuccess(null); 56 | result.onTestCompleted(null); 57 | assertEquals(2, result.runCount); 58 | } 59 | 60 | } 61 | } -------------------------------------------------------------------------------- /asunit-4.0/test/asunit/framework/RunnerFactoryTest.as: -------------------------------------------------------------------------------- 1 | package asunit.framework { 2 | 3 | import asunit.asserts.*; 4 | import asunit.errors.UsageError; 5 | import asunit.framework.IRunner; 6 | import asunit.runners.TestRunner; 7 | import asunit.runners.SuiteRunner; 8 | import asunit.support.RunWithButNoType; 9 | import asunit.support.RunWithSuiteButNoType; 10 | import asunit.support.SingleSuccessSuite; 11 | import asunit.support.SucceedAssertTrue; 12 | 13 | import flash.display.Sprite; 14 | 15 | public class RunnerFactoryTest { 16 | 17 | private var factory:IRunnerFactory; 18 | 19 | [Before] 20 | public function before():void { 21 | factory = new RunnerFactory(); 22 | } 23 | 24 | [Test] 25 | public function shouldCreateDefaultRunner():void { 26 | var result:IRunner = factory.runnerFor(SucceedAssertTrue); 27 | assertTrue(result is TestRunner); 28 | } 29 | 30 | [Test] 31 | public function shouldCreateSuiteRunner():void { 32 | var result:IRunner = factory.runnerFor(SingleSuccessSuite); 33 | assertTrue(result is SuiteRunner); 34 | } 35 | 36 | [Test(expects="asunit.errors.UsageError")] 37 | public function shouldFailWhenGivenANonTestOrSuite():void { 38 | factory.runnerFor(Sprite); 39 | } 40 | 41 | [Test(expects="asunit.errors.UsageError")] 42 | public function runWithOnTestWithNoTypeDeclaration():void { 43 | factory.runnerFor(RunWithButNoType); 44 | } 45 | 46 | [Test(expects="asunit.errors.UsageError")] 47 | public function runWithOnSuiteWithNoTypeDeclaration():void { 48 | factory.runnerFor(RunWithSuiteButNoType); 49 | } 50 | } 51 | } 52 | 53 | -------------------------------------------------------------------------------- /asunit-4.0/test/asunit/framework/TestCaseMock.as: -------------------------------------------------------------------------------- 1 | package asunit.framework { 2 | 3 | public class TestCaseMock extends TestCase { 4 | public var testMethod1Run:Boolean; 5 | public var testMethod2Run:Boolean; 6 | public var testMethod3Run:Boolean; 7 | 8 | public function TestCaseMock(methodName:String = null) { 9 | super(methodName); 10 | } 11 | 12 | public function testMethod1():void { 13 | testMethod1Run = true; 14 | } 15 | 16 | public function testMethod2():void { 17 | testMethod2Run = true; 18 | } 19 | 20 | public function testMethod3():void { 21 | testMethod3Run = true; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /asunit-4.0/test/asunit/framework/TestIteratorMethodByNameTest.as: -------------------------------------------------------------------------------- 1 | package asunit.framework { 2 | 3 | import asunit.framework.TestCase; 4 | 5 | import asunit.support.MultiMethod; 6 | 7 | public class TestIteratorMethodByNameTest extends TestCase { 8 | 9 | private var iterator:TestIterator; 10 | private var multiTest:MultiMethod; 11 | 12 | public function TestIteratorMethodByNameTest(testMethod:String = null) { 13 | super(testMethod); 14 | } 15 | 16 | protected override function setUp():void { 17 | multiTest = new MultiMethod(); 18 | } 19 | 20 | protected override function tearDown():void { 21 | iterator = null; 22 | multiTest = null; 23 | } 24 | 25 | public function test_iterator_next_with_test_method_by_name():void { 26 | iterator = new TestIterator(multiTest, 'stage_is_null_by_default'); 27 | checkAllNextCalls(iterator); 28 | } 29 | 30 | private function checkAllNextCalls(iterator:TestIterator):void { 31 | assertSame('runBeforeClass1', iterator.next().name); 32 | assertSame('runBeforeClass2', iterator.next().name); 33 | 34 | assertSame('runBefore1', iterator.next().name); 35 | assertSame('runBefore2', iterator.next().name); 36 | assertSame('stage_is_null_by_default', iterator.next().name); 37 | 38 | // NOTE: When a method name is provided, the teardown should 39 | // not occur. 40 | //assertSame('runAfter1', iterator.next().name); 41 | //assertSame('runAfter2', iterator.next().name); 42 | 43 | //assertSame('runAfterClass1', iterator.next().name); 44 | //assertSame('runAfterClass2', iterator.next().name); 45 | 46 | assertFalse('no methods left in iterator', iterator.hasNext()); 47 | } 48 | 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /asunit-4.0/test/asunit/framework/TestIteratorOrderedTestMethodTest.as: -------------------------------------------------------------------------------- 1 | package asunit.framework { 2 | 3 | import asunit.framework.TestCase; 4 | import asunit.util.Iterator; 5 | 6 | import asunit.support.OrderedTestMethod; 7 | 8 | public class TestIteratorOrderedTestMethodTest extends TestCase { 9 | 10 | private var iterator:Iterator; 11 | private var orderedTest:OrderedTestMethod; 12 | 13 | public function TestIteratorOrderedTestMethodTest(testMethod:String = null) { 14 | super(testMethod); 15 | } 16 | 17 | protected override function setUp():void { 18 | super.setUp(); 19 | orderedTest = new OrderedTestMethod(); 20 | } 21 | 22 | protected override function tearDown():void { 23 | super.tearDown(); 24 | iterator = null; 25 | orderedTest = null; 26 | } 27 | 28 | public function test_countTestMethods_of_test():void { 29 | iterator = new TestIterator(orderedTest); 30 | assertEquals(4, iterator.length); 31 | } 32 | 33 | public function test_get_test_methods_of_test_instance():void { 34 | //NOTE: Avoid naming variables the same as testMethods property in asunit.framework.TestCase. 35 | var iterator:Iterator = new TestIterator(orderedTest); 36 | 37 | assertEquals(4, iterator.length); 38 | var first:Method = iterator.next(); 39 | var second:Method = iterator.next(); 40 | var third:Method = iterator.next(); 41 | var fourth:Method = iterator.next(); 42 | 43 | assertFalse("Should be out of items", iterator.next()); 44 | 45 | assertEquals(first.name, 'negativeOrderIsAllowed'); 46 | assertEquals(second.name, 'zeroIsDefaultOrder'); 47 | assertEquals(third.name, 'two'); 48 | assertEquals(fourth.name, 'three'); 49 | 50 | assertEquals(orderedTest.negativeOrderIsAllowed, first.value); 51 | assertEquals(orderedTest.zeroIsDefaultOrder, second.value); 52 | assertEquals(orderedTest.two, third.value); 53 | assertEquals(orderedTest.three, fourth.value); 54 | } 55 | } 56 | } 57 | 58 | -------------------------------------------------------------------------------- /asunit-4.0/test/asunit/framework/TestIteratorSingleMethodTest.as: -------------------------------------------------------------------------------- 1 | package asunit.framework { 2 | 3 | import asunit.framework.TestCase; 4 | import asunit.util.Iterator; 5 | 6 | import asunit.support.FailAssertTrue; 7 | 8 | public class TestIteratorSingleMethodTest extends TestCase { 9 | 10 | private var iterator:Iterator; 11 | private var singleTest:FailAssertTrue; 12 | 13 | public function TestIteratorSingleMethodTest(testMethod:String = null) { 14 | super(testMethod); 15 | } 16 | 17 | protected override function setUp():void { 18 | super.setUp(); 19 | singleTest = new FailAssertTrue(); 20 | } 21 | 22 | protected override function tearDown():void { 23 | super.tearDown(); 24 | iterator = null; 25 | singleTest = null; 26 | } 27 | 28 | public function test_iterator_for_null_yields_hasNext_false():void { 29 | iterator = new TestIterator(null); 30 | assertFalse(iterator.hasNext()); 31 | } 32 | 33 | public function test_iterator_for_non_test_yields_hasNext_false():void { 34 | iterator = new TestIterator(new Date()); 35 | assertFalse(iterator.hasNext()); 36 | } 37 | 38 | public function test_iterator_for_test_with_one_test_method_hasNext():void { 39 | iterator = new TestIterator(singleTest); 40 | assertTrue(iterator.hasNext()); 41 | } 42 | 43 | public function test_iterator_next():void { 44 | iterator = new TestIterator(singleTest); 45 | 46 | assertTrue('a', iterator.hasNext()); 47 | assertEquals('runBefore', iterator.next().toString()); 48 | assertTrue('b', iterator.hasNext()); 49 | assertEquals('fail_assertTrue', iterator.next().toString()); 50 | assertTrue('c', iterator.hasNext()); 51 | assertEquals('runAfter', iterator.next().toString()); 52 | assertFalse('no methods left in iterator', iterator.hasNext()); 53 | } 54 | } 55 | } 56 | 57 | -------------------------------------------------------------------------------- /asunit-4.0/test/asunit/framework/VisualTestCaseTest.as: -------------------------------------------------------------------------------- 1 | package asunit.framework { 2 | 3 | import asunit.asserts.*; 4 | 5 | import flash.display.Sprite; 6 | 7 | public class VisualTestCaseTest { 8 | 9 | [Inject] 10 | public var context:Sprite; 11 | 12 | [Test] 13 | public function instantiated():void { 14 | assertTrue(context is Sprite); 15 | } 16 | 17 | } 18 | } 19 | 20 | -------------------------------------------------------------------------------- /asunit-4.0/test/asunit/framework/assertAssertionFailed.as: -------------------------------------------------------------------------------- 1 | package asunit.framework 2 | { 3 | import asunit.errors.AssertionFailedError; 4 | import asunit.framework.Assert; 5 | 6 | internal function assertAssertionFailed(assertFunction:Function, expected:Object, actual:Object):void { 7 | var succeeded:Boolean = false; 8 | try { 9 | assertFunction.apply(null, [expected, actual]); 10 | succeeded = true; 11 | } 12 | catch (e:AssertionFailedError) { 13 | // expected 14 | } 15 | if (succeeded) { 16 | Assert.fail("expected AssertionFailedError"); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /asunit-4.0/test/asunit/printers/FlashBuilderPrinterTest.as: -------------------------------------------------------------------------------- 1 | 2 | package asunit.printers { 3 | 4 | import asunit.asserts.*; 5 | import asunit.framework.TestCase; 6 | 7 | public class FlashBuilderPrinterTest extends TestCase { 8 | 9 | public function FlashBuilderPrinterTest(method:String=null) { 10 | super(method); 11 | } 12 | 13 | private function testInstantiable():void { 14 | var printer:FlashBuilderPrinter = new FlashBuilderPrinter(); 15 | } 16 | } 17 | } 18 | 19 | -------------------------------------------------------------------------------- /asunit-4.0/test/asunit/runners/LegacyRunnerTest.as: -------------------------------------------------------------------------------- 1 | package asunit.runners { 2 | 3 | import asunit.framework.IResult; 4 | import asunit.framework.LegacyTestIterator; 5 | import asunit.framework.Result; 6 | import asunit.framework.TestCase; 7 | import asunit.support.LegacyTestCase; 8 | import flash.display.Sprite; 9 | 10 | import flash.events.Event; 11 | 12 | public class LegacyRunnerTest extends TestCase { 13 | 14 | private var testRunner:LegacyRunner; 15 | 16 | public function LegacyRunnerTest(methodName:String=null) { 17 | super(methodName) 18 | } 19 | 20 | override protected function setUp():void { 21 | super.setUp(); 22 | LegacyTestCase.callCount = 0; 23 | testRunner = new LegacyRunner(); 24 | } 25 | 26 | override protected function tearDown():void { 27 | super.tearDown(); 28 | testRunner = null; 29 | } 30 | 31 | public function testSimpleSubclass():void { 32 | var handler:Function = function(event:Event):void { 33 | assertEquals(0, testRunner.result.failureCount); 34 | assertEquals(2, testRunner.result.runCount); 35 | }; 36 | testRunner.addEventListener(Event.COMPLETE, addAsync(handler)); 37 | testRunner.run(LegacyTestCase, null, new Sprite()); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /asunit-4.0/test/asunit/runners/SuiteRunnerTest.as: -------------------------------------------------------------------------------- 1 | package asunit.runners { 2 | 3 | import asunit.asserts.*; 4 | import asunit.framework.IAsync; 5 | import asunit.framework.Result; 6 | import asunit.support.DoubleFailSuite; 7 | import asunit.support.InjectionVerification; 8 | import flash.display.Sprite; 9 | 10 | import flash.events.Event; 11 | 12 | public class SuiteRunnerTest { 13 | 14 | [Inject] 15 | public var async:IAsync; 16 | private var suiteRunner:SuiteRunner; 17 | private var runnerResult:Result; 18 | 19 | [Before] 20 | public function setUp():void { 21 | runnerResult = new Result(); 22 | suiteRunner = new SuiteRunner(null, runnerResult); 23 | } 24 | 25 | public function testRunTriggersCompleteEvent():void { 26 | suiteRunner.addEventListener(Event.COMPLETE, async.add(checkResultWasNotSuccessful)); 27 | suiteRunner.run(DoubleFailSuite); 28 | } 29 | 30 | private function checkResultWasNotSuccessful(event:Event):void { 31 | assertFalse(runnerResult.wasSuccessful); 32 | } 33 | 34 | [Test] 35 | public function testCanHandATestToSuiteRunner():void { 36 | suiteRunner.addEventListener(Event.COMPLETE, async.add()); 37 | suiteRunner.run(InjectionVerification, null, new Sprite()); 38 | assertFalse(runnerResult.wasSuccessful); 39 | } 40 | } 41 | } 42 | 43 | 44 | -------------------------------------------------------------------------------- /asunit-4.0/test/asunit/runners/TestRunnerErrorMethodTest.as: -------------------------------------------------------------------------------- 1 | package asunit.runners { 2 | 3 | import asunit.framework.TestCase; 4 | 5 | import asunit.framework.IResult; 6 | import asunit.framework.Result; 7 | import asunit.framework.TestFailure; 8 | import asunit.support.ErrorInMethod; 9 | 10 | import flash.events.Event; 11 | 12 | public class TestRunnerErrorMethodTest extends TestCase { 13 | 14 | private var runner:TestRunner; 15 | private var testWithError:ErrorInMethod; 16 | 17 | public function TestRunnerErrorMethodTest(testMethod:String = null) { 18 | super(testMethod); 19 | } 20 | 21 | protected override function setUp():void { 22 | super.setUp(); 23 | runner = new TestRunner(); 24 | testWithError = new ErrorInMethod(); 25 | } 26 | 27 | protected override function tearDown():void { 28 | super.tearDown(); 29 | runner = null; 30 | testWithError = null; 31 | } 32 | 33 | public function testInstantiated():void { 34 | assertTrue("TestRunner instantiated", runner is TestRunner); 35 | } 36 | 37 | public function test_run_with_errors():void { 38 | runner.addEventListener(Event.COMPLETE, addAsync(check_Result_has_one_error, 100)); 39 | runner.run(ErrorInMethod); 40 | } 41 | 42 | private function check_Result_has_one_error(e:Event):void { 43 | var runnerResult:IResult = runner.result; 44 | assertFalse('runnerResult.wasSuccessful', runnerResult.wasSuccessful); 45 | 46 | assertEquals('one error in testResult', 1, runnerResult.errorCount); 47 | assertEquals('no failures in testResult', 0, runnerResult.failureCount); 48 | 49 | var failure0:TestFailure = runnerResult.errors[0] as TestFailure; 50 | assertTrue('thrownException is correct type', failure0.thrownException is ArgumentError); 51 | assertTrue('failedTest is an instance of the test class', failure0.failedTest is ErrorInMethod); 52 | assertSame('failedMethod name', 'throw_ArgumentError', failure0.failedMethod); 53 | } 54 | } 55 | } 56 | 57 | -------------------------------------------------------------------------------- /asunit-4.0/test/asunit/runners/TestRunnerIgnoredMethodTest.as: -------------------------------------------------------------------------------- 1 | package asunit.runners { 2 | 3 | import asunit.framework.TestCase; 4 | 5 | import asunit.support.IgnoredMethod; 6 | 7 | import flash.events.Event; 8 | 9 | public class TestRunnerIgnoredMethodTest extends TestCase { 10 | 11 | private var ignoredTest:Class; 12 | private var runner:TestRunner; 13 | 14 | public function TestRunnerIgnoredMethodTest(testMethod:String = null) { 15 | super(testMethod); 16 | } 17 | 18 | protected override function setUp():void { 19 | super.setUp(); 20 | ignoredTest = IgnoredMethod; 21 | runner = new TestRunner(); 22 | } 23 | 24 | protected override function tearDown():void { 25 | super.tearDown(); 26 | ignoredTest = null; 27 | runner = null; 28 | } 29 | 30 | public function testRunWithIgnoredMethod():void { 31 | runner.addEventListener(Event.COMPLETE, addAsync(checkResultHasOneIgnoredMethod, 100)); 32 | runner.run(ignoredTest); 33 | } 34 | 35 | private function checkResultHasOneIgnoredMethod(e:Event):void { 36 | assertFalse('runnerResult.failureEncountered', runner.result.failureEncountered); 37 | assertEquals('one ignored test in result', 1, runner.result.ignoredTests.length); 38 | } 39 | } 40 | } 41 | 42 | -------------------------------------------------------------------------------- /asunit-4.0/test/asunit/support/CustomParameters.as: -------------------------------------------------------------------------------- 1 | package asunit.support { 2 | 3 | public class CustomParameters { 4 | 5 | public var someArray:Array; 6 | public var someBoolean:Boolean; 7 | public var someInt:int; 8 | public var someNumber:Number; 9 | public var someString:String; 10 | public var someUInt:uint; 11 | } 12 | } 13 | 14 | -------------------------------------------------------------------------------- /asunit-4.0/test/asunit/support/CustomSuiteRunner.as: -------------------------------------------------------------------------------- 1 | package asunit.support { 2 | 3 | import asunit.framework.IResult; 4 | import asunit.framework.IRunnerFactory; 5 | import asunit.runners.SuiteRunner; 6 | 7 | import flash.display.DisplayObjectContainer; 8 | 9 | public class CustomSuiteRunner extends SuiteRunner { 10 | 11 | // Used so that test cases can 12 | // verify that this custom runner 13 | // worked. 14 | public static var runCalledCount:int; 15 | 16 | public function CustomSuiteRunner(factory:IRunnerFactory = null) { 17 | super(factory); 18 | } 19 | 20 | override public function run(testClass:Class, testMethod:String=null, visualContext:DisplayObjectContainer=null):void { 21 | runCalledCount++; 22 | super.run(testClass, testMethod, visualContext); 23 | } 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /asunit-4.0/test/asunit/support/DoubleFailSuite.as: -------------------------------------------------------------------------------- 1 | package asunit.support { 2 | 3 | [Suite] 4 | public class DoubleFailSuite { 5 | public var failAssertTrueTest:FailAssertTrue; 6 | public var failAssertEqualsTest:FailAssertEquals; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /asunit-4.0/test/asunit/support/DoubleNestedSuite.as: -------------------------------------------------------------------------------- 1 | package asunit.support { 2 | 3 | [Suite] 4 | public class DoubleNestedSuite { 5 | // contains two suites 6 | public var suiteOfTwoSuites:SuiteOfTwoSuites; 7 | 8 | // contains a single test 9 | public var singleErrorSuite:SingleErrorSuite; 10 | 11 | // a single test not in a suite 12 | public var ignoredMethodTest:IgnoredMethod; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /asunit-4.0/test/asunit/support/ErrorInMethod.as: -------------------------------------------------------------------------------- 1 | package asunit.support { 2 | 3 | public class ErrorInMethod { 4 | 5 | [Test] 6 | public function throw_ArgumentError():void { 7 | throw new ArgumentError('generated by ErrorInMethod'); 8 | } 9 | 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /asunit-4.0/test/asunit/support/FailAssertEquals.as: -------------------------------------------------------------------------------- 1 | package asunit.support { 2 | 3 | import asunit.asserts.*; 4 | 5 | public class FailAssertEquals { 6 | 7 | public var methodsCalled:Array; 8 | 9 | public function FailAssertEquals() { 10 | methodsCalled = []; 11 | } 12 | 13 | [Before] 14 | public function runBefore():void { 15 | methodsCalled.push(arguments.callee); 16 | } 17 | 18 | [After] 19 | public function runAfter():void { 20 | methodsCalled.push(arguments.callee); 21 | } 22 | 23 | [Test] 24 | public function fail_assertEquals():void { 25 | methodsCalled.push(arguments.callee); 26 | assertEquals('Words should be equal', 'right', 'wrong'); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /asunit-4.0/test/asunit/support/FailAssertTrue.as: -------------------------------------------------------------------------------- 1 | package asunit.support { 2 | 3 | import asunit.asserts.*; 4 | 5 | public class FailAssertTrue { 6 | 7 | public var methodsCalled:Array; 8 | 9 | [Before] 10 | public function runBefore():void { 11 | methodsCalled = []; 12 | methodsCalled.push(arguments.callee); 13 | } 14 | 15 | [After] 16 | public function runAfter():void { 17 | methodsCalled.push(arguments.callee); 18 | } 19 | 20 | [Test] 21 | public function fail_assertTrue():void { 22 | methodsCalled.push(arguments.callee); 23 | assertTrue('Law of non-contradiction', false); 24 | } 25 | 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /asunit-4.0/test/asunit/support/FakeObserver.as: -------------------------------------------------------------------------------- 1 | package asunit.support { 2 | 3 | import asunit.framework.IResult; 4 | import asunit.framework.IRunListener; 5 | import asunit.framework.ITestFailure; 6 | import asunit.framework.ITestSuccess; 7 | import asunit.framework.ITestWarning; 8 | import asunit.framework.Method; 9 | 10 | public class FakeObserver implements IRunListener { 11 | 12 | public var onRunStartedCalled:Boolean; 13 | public var onTestStartedCalled:Boolean; 14 | 15 | public function onRunStarted():void { 16 | onRunStartedCalled = true; 17 | } 18 | 19 | public function onRunCompleted(result:IResult):void { 20 | } 21 | 22 | public function onTestStarted(test:Object):void { 23 | onTestStartedCalled = true; 24 | } 25 | 26 | public function onTestCompleted(test:Object):void { 27 | } 28 | 29 | public function onTestFailure(failure:ITestFailure):void { 30 | } 31 | 32 | public function onTestSuccess(success:ITestSuccess):void { 33 | } 34 | 35 | public function onTestIgnored(method:Method):void { 36 | } 37 | 38 | public function onWarning(warning:ITestWarning):void { 39 | } 40 | } 41 | } 42 | 43 | -------------------------------------------------------------------------------- /asunit-4.0/test/asunit/support/IgnoredMethod.as: -------------------------------------------------------------------------------- 1 | package asunit.support { 2 | 3 | import asunit.asserts.*; 4 | 5 | public class IgnoredMethod { 6 | 7 | [Before] 8 | public function runBefore():void { 9 | } 10 | 11 | [After] 12 | public function runAfter():void { 13 | } 14 | 15 | [Ignore("because")] 16 | [Test] 17 | public function should_be_ignored():void { 18 | fail('this test method should be ignored'); 19 | } 20 | 21 | [Test] 22 | public function should_not_be_ignored():void { 23 | } 24 | 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /asunit-4.0/test/asunit/support/InjectionFailure.as: -------------------------------------------------------------------------------- 1 | package asunit.support { 2 | 3 | import asunit.asserts.*; 4 | import asunit.framework.Async; 5 | import asunit.framework.IAsync; 6 | 7 | import flash.display.Sprite; 8 | 9 | public class InjectionFailure { 10 | 11 | [Inject(unknownValue="foo")] 12 | public var custom:CustomParameters; 13 | 14 | [Test] 15 | public function unknownValueShouldExplode():void { 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /asunit-4.0/test/asunit/support/InjectionVerification.as: -------------------------------------------------------------------------------- 1 | package asunit.support { 2 | 3 | import asunit.asserts.*; 4 | import asunit.framework.Async; 5 | import asunit.framework.IAsync; 6 | 7 | import flash.display.Sprite; 8 | 9 | public class InjectionVerification { 10 | 11 | [Inject] 12 | public var iAsync:IAsync; 13 | 14 | [Inject] 15 | public var async:Async; 16 | 17 | [Inject] 18 | public var context:Sprite; 19 | 20 | [Test] 21 | public function verifyDisplayObjectInjection():void { 22 | assertNotNull("DisplayObject should exist", context); 23 | } 24 | 25 | [Test] 26 | public function verifyDisplayObjectAttachedToStage():void { 27 | assertNotNull("DisplayObjects should be attached to stage", context.stage); 28 | } 29 | 30 | [Test] 31 | public function verifyAsyncInjection():void { 32 | assertNotNull(async); 33 | } 34 | 35 | [Test] 36 | public function verifyIAsyncInjection():void { 37 | assertNotNull(iAsync); 38 | } 39 | } 40 | } 41 | 42 | -------------------------------------------------------------------------------- /asunit-4.0/test/asunit/support/LegacyTestCase.as: -------------------------------------------------------------------------------- 1 | package asunit.support { 2 | 3 | import asunit.framework.TestCase; 4 | 5 | public class LegacyTestCase extends TestCase { 6 | 7 | public static var callCount:int; 8 | 9 | private var instance:*; 10 | 11 | override protected function setUp():void { 12 | super.setUp(); 13 | instance = {}; 14 | instance.name = "foo"; 15 | } 16 | 17 | override protected function tearDown():void { 18 | super.tearDown(); 19 | instance = null; 20 | } 21 | 22 | public function testSomething():void { 23 | assertEquals("foo", instance.name); 24 | } 25 | 26 | public function someNonTestMethod():void { 27 | throw new Error("This should not be called"); 28 | } 29 | 30 | [Test] 31 | // Ensure this method only gets called once 32 | // in a given test run... 33 | public function testSomethingElse():void { 34 | callCount++; 35 | } 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /asunit-4.0/test/asunit/support/MultiMethod.as: -------------------------------------------------------------------------------- 1 | package asunit.support { 2 | 3 | import asunit.asserts.*; 4 | 5 | import flash.display.Sprite; 6 | 7 | public class MultiMethod { 8 | 9 | public static var methodsCalled:Array = []; 10 | 11 | protected var sprite:Sprite; 12 | 13 | public function MultiMethod() { 14 | } 15 | 16 | [BeforeClass] 17 | public static function runBeforeClass1():void { 18 | methodsCalled.push(arguments.callee); 19 | } 20 | 21 | [BeforeClass] 22 | public static function runBeforeClass2():void { 23 | methodsCalled.push(arguments.callee); 24 | } 25 | 26 | [Before] 27 | public function runBefore1():void { 28 | methodsCalled.push(arguments.callee); 29 | sprite = new Sprite(); 30 | } 31 | 32 | [Before] 33 | public function runBefore2():void { 34 | methodsCalled.push(arguments.callee); 35 | } 36 | 37 | [After] 38 | public function runAfter1():void { 39 | methodsCalled.push(arguments.callee); 40 | sprite = null; 41 | } 42 | 43 | [After] 44 | public function runAfter2():void { 45 | methodsCalled.push(arguments.callee); 46 | } 47 | 48 | [Test] 49 | public function numChildren_is_0_by_default():void { 50 | methodsCalled.push(arguments.callee); 51 | assertEquals(0, sprite.numChildren); 52 | } 53 | 54 | [Test] 55 | public function stage_is_null_by_default():void { 56 | methodsCalled.push(arguments.callee); 57 | assertNull(sprite.stage); 58 | } 59 | 60 | [Test] 61 | public function fail_assertEquals():void { 62 | methodsCalled.push(arguments.callee); 63 | assertEquals('wrongName', sprite.name); 64 | } 65 | 66 | [AfterClass] 67 | public static function runAfterClass1():void { 68 | methodsCalled.push(arguments.callee); 69 | } 70 | 71 | [AfterClass] 72 | public static function runAfterClass2():void { 73 | methodsCalled.push(arguments.callee); 74 | } 75 | } 76 | } 77 | 78 | -------------------------------------------------------------------------------- /asunit-4.0/test/asunit/support/OrderedTestMethod.as: -------------------------------------------------------------------------------- 1 | package asunit.support { 2 | 3 | import asunit.asserts.*; 4 | 5 | import flash.display.Sprite; 6 | 7 | public class OrderedTestMethod { 8 | 9 | public var methodsCalled:Array = []; 10 | 11 | public function OrderedTestMethod() { 12 | } 13 | 14 | // Method names are chosen to avoid coinciding with alphabetical order. 15 | 16 | [Test(order=2)] 17 | public function two():void { 18 | methodsCalled.push(arguments.callee); 19 | } 20 | 21 | [Test(order=3)] 22 | public function three():void { 23 | methodsCalled.push(arguments.callee); 24 | } 25 | 26 | [Test] 27 | public function zeroIsDefaultOrder():void { 28 | methodsCalled.push(arguments.callee); 29 | } 30 | 31 | [Test(order=-1)] 32 | public function negativeOrderIsAllowed():void { 33 | methodsCalled.push(arguments.callee); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /asunit-4.0/test/asunit/support/RunWithButNoType.as: -------------------------------------------------------------------------------- 1 | package asunit.support { 2 | 3 | import asunit.asserts.*; 4 | 5 | [RunWith] 6 | public class RunWithButNoType { 7 | 8 | [Test] 9 | public function simplePassing():void { 10 | assertTrue("This will pass, we're interested in the RunWith", true); 11 | } 12 | } 13 | } 14 | 15 | -------------------------------------------------------------------------------- /asunit-4.0/test/asunit/support/RunWithSuiteButNoType.as: -------------------------------------------------------------------------------- 1 | package asunit.support { 2 | 3 | [RunWith] 4 | [Suite] 5 | public class RunWithSuiteButNoType { 6 | 7 | // Just used to indicate this is a Suite: 8 | public var testCase:SucceedAssertTrue; 9 | } 10 | } 11 | 12 | -------------------------------------------------------------------------------- /asunit-4.0/test/asunit/support/SingleErrorSuite.as: -------------------------------------------------------------------------------- 1 | package asunit.support { 2 | 3 | [Suite] 4 | public class SingleErrorSuite { 5 | public var errorInMethodTest:ErrorInMethod; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /asunit-4.0/test/asunit/support/SingleSuccessSuite.as: -------------------------------------------------------------------------------- 1 | package asunit.support { 2 | 3 | [Suite] 4 | public class SingleSuccessSuite { 5 | public var succeedAssertTrue:SucceedAssertTrue; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /asunit-4.0/test/asunit/support/SucceedAssertTrue.as: -------------------------------------------------------------------------------- 1 | package asunit.support { 2 | 3 | import asunit.asserts.*; 4 | 5 | public class SucceedAssertTrue{ 6 | 7 | public var methodsCalled:Array; 8 | 9 | public function SucceedAssertTrue() { 10 | methodsCalled = []; 11 | } 12 | 13 | [Before] 14 | public function runBefore():void { 15 | methodsCalled.push(arguments.callee); 16 | } 17 | 18 | [After] 19 | public function runAfter():void { 20 | methodsCalled.push(arguments.callee); 21 | } 22 | 23 | [Test] 24 | public function succeed_assertTrue():void { 25 | methodsCalled.push(arguments.callee); 26 | assertTrue(true); 27 | } 28 | 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /asunit-4.0/test/asunit/support/SuiteOfTwoSuites.as: -------------------------------------------------------------------------------- 1 | package asunit.support { 2 | 3 | [Suite] 4 | public class SuiteOfTwoSuites { 5 | public var singleSuccessSuite:SingleSuccessSuite; 6 | public var doubleFailSuite:DoubleFailSuite; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /asunit-4.0/test/asunit/support/SuiteWithCustomRunner.as: -------------------------------------------------------------------------------- 1 | package asunit.support { 2 | 3 | [Suite] 4 | [RunWith("asunit.support.CustomSuiteRunner")] 5 | public class SuiteWithCustomRunner { 6 | 7 | public var succeedAssertTrue:SucceedAssertTrue; 8 | public var singleSuccessSuite:SingleSuccessSuite; 9 | public var multiMethod:MultiMethod; 10 | } 11 | } 12 | 13 | -------------------------------------------------------------------------------- /asunit-4.0/test/asunit/support/SuiteWithOneCustomChildSuite.as: -------------------------------------------------------------------------------- 1 | package asunit.support { 2 | 3 | [Suite] 4 | public class SuiteWithOneCustomChildSuite { 5 | 6 | public var suiteWithCustomRunner:SuiteWithCustomRunner; 7 | public var orderedTestMethod:OrderedTestMethod; 8 | } 9 | } 10 | 11 | -------------------------------------------------------------------------------- /asunit-4.0/vendor/as3injection/org/swiftsuspenders/InjectionType.as: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 the original author or authors 3 | * 4 | * Permission is hereby granted to use, modify, and distribute this file 5 | * in accordance with the terms of the license agreement accompanying it. 6 | */ 7 | 8 | package org.swiftsuspenders 9 | { 10 | public class InjectionType 11 | { 12 | public static const VALUE : int = 0; 13 | public static const CLASS : int = 1; 14 | public static const SINGLETON : int = 2; 15 | } 16 | } -------------------------------------------------------------------------------- /asunit-4.0/vendor/as3injection/org/swiftsuspenders/InjectorError.as: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 the original author or authors 3 | * 4 | * Permission is hereby granted to use, modify, and distribute this file 5 | * in accordance with the terms of the license agreement accompanying it. 6 | */ 7 | 8 | package org.swiftsuspenders 9 | { 10 | public class InjectorError extends Error 11 | { 12 | public function InjectorError(message:*="", id:*=0) 13 | { 14 | super(message, id); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /asunit-4.0/vendor/as3injection/org/swiftsuspenders/getConstructor.as: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 the original author or authors 3 | * 4 | * Permission is hereby granted to use, modify, and distribute this file 5 | * in accordance with the terms of the license agreement accompanying it. 6 | */ 7 | 8 | package org.swiftsuspenders 9 | { 10 | import flash.utils.Proxy; 11 | import flash.utils.getDefinitionByName; 12 | import flash.utils.getQualifiedClassName; 13 | 14 | internal function getConstructor(value : Object) : Class 15 | { 16 | /* 17 | There are several types for which the 'constructor' property doesn't work: 18 | - instances of Proxy, XML and XMLList throw exceptions when trying to access 'constructor' 19 | - int and uint return Number as their constructor 20 | For these, we have to fall back to more verbose ways of getting the constructor. 21 | 22 | Additionally, Vector instances always return Vector.<*> when queried for their constructor. 23 | Ideally, that would also be resolved, but the SwiftSuspenders wouldn't be compatible with 24 | Flash Player < 10, anymore. 25 | */ 26 | if (value is Proxy || value is Number || value is XML || value is XMLList) 27 | { 28 | var fqcn : String = getQualifiedClassName(value); 29 | return Class(getDefinitionByName(fqcn)); 30 | } 31 | return value.constructor; 32 | } 33 | } -------------------------------------------------------------------------------- /asunit-4.0/vendor/as3injection/org/swiftsuspenders/injectionpoints/InjectionPoint.as: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 the original author or authors 3 | * 4 | * Permission is hereby granted to use, modify, and distribute this file 5 | * in accordance with the terms of the license agreement accompanying it. 6 | */ 7 | 8 | package org.swiftsuspenders.injectionpoints 9 | { 10 | import org.swiftsuspenders.Injector; 11 | 12 | public class InjectionPoint 13 | { 14 | /******************************************************************************************* 15 | * public methods * 16 | *******************************************************************************************/ 17 | public function InjectionPoint(node : XML, injector : Injector) 18 | { 19 | initializeInjection(node, injector); 20 | } 21 | 22 | public function applyInjection(target : Object, injector : Injector) : Object 23 | { 24 | return target; 25 | } 26 | 27 | 28 | /******************************************************************************************* 29 | * protected methods * 30 | *******************************************************************************************/ 31 | protected function initializeInjection(node : XML, injector : Injector) : void 32 | { 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /asunit-4.0/vendor/as3injection/org/swiftsuspenders/injectionpoints/NoParamsConstructorInjectionPoint.as: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 the original author or authors 3 | * 4 | * Permission is hereby granted to use, modify, and distribute this file 5 | * in accordance with the terms of the license agreement accompanying it. 6 | */ 7 | 8 | package org.swiftsuspenders.injectionpoints 9 | { 10 | import org.swiftsuspenders.Injector; 11 | 12 | public class NoParamsConstructorInjectionPoint extends InjectionPoint 13 | { 14 | public function NoParamsConstructorInjectionPoint() 15 | { 16 | super(null, null); 17 | } 18 | 19 | override public function applyInjection(target : Object, injector : Injector) : Object 20 | { 21 | return new target(); 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /asunit-4.0/vendor/as3injection/org/swiftsuspenders/injectionpoints/PostConstructInjectionPoint.as: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 the original author or authors 3 | * 4 | * Permission is hereby granted to use, modify, and distribute this file 5 | * in accordance with the terms of the license agreement accompanying it. 6 | */ 7 | 8 | package org.swiftsuspenders.injectionpoints 9 | { 10 | import org.swiftsuspenders.Injector; 11 | 12 | public class PostConstructInjectionPoint extends InjectionPoint 13 | { 14 | /******************************************************************************************* 15 | * private properties * 16 | *******************************************************************************************/ 17 | protected var methodName : String; 18 | protected var orderValue:int; 19 | 20 | 21 | /******************************************************************************************* 22 | * public methods * 23 | *******************************************************************************************/ 24 | public function PostConstructInjectionPoint(node:XML, injector : Injector) 25 | { 26 | super(node, injector); 27 | } 28 | 29 | public function get order():int 30 | { 31 | return orderValue; 32 | } 33 | 34 | override public function applyInjection(target : Object, injector : Injector) : Object 35 | { 36 | target[methodName](); 37 | return target; 38 | } 39 | 40 | 41 | /******************************************************************************************* 42 | * protected methods * 43 | *******************************************************************************************/ 44 | override protected function initializeInjection(node : XML, injector : Injector) : void 45 | { 46 | var orderArg : XMLList = node.arg.(@key == 'order'); 47 | var methodNode : XML = node.parent(); 48 | orderValue = int(orderArg.@value); 49 | methodName = methodNode.@name.toString(); 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /asunit-4.0/vendor/as3injection/org/swiftsuspenders/injectionresults/InjectClassResult.as: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 the original author or authors 3 | * 4 | * Permission is hereby granted to use, modify, and distribute this file 5 | * in accordance with the terms of the license agreement accompanying it. 6 | */ 7 | 8 | package org.swiftsuspenders.injectionresults 9 | { 10 | import org.swiftsuspenders.Injector; 11 | 12 | public class InjectClassResult extends InjectionResult 13 | { 14 | /******************************************************************************************* 15 | * private properties * 16 | *******************************************************************************************/ 17 | private var m_responseType : Class; 18 | 19 | 20 | /******************************************************************************************* 21 | * public methods * 22 | *******************************************************************************************/ 23 | public function InjectClassResult(responseType : Class) 24 | { 25 | m_responseType = responseType; 26 | } 27 | 28 | override public function getResponse(injector : Injector) : Object 29 | { 30 | return injector.instantiate(m_responseType); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /asunit-4.0/vendor/as3injection/org/swiftsuspenders/injectionresults/InjectOtherRuleResult.as: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 the original author or authors 3 | * 4 | * Permission is hereby granted to use, modify, and distribute this file 5 | * in accordance with the terms of the license agreement accompanying it. 6 | */ 7 | 8 | package org.swiftsuspenders.injectionresults 9 | { 10 | import org.swiftsuspenders.InjectionConfig; 11 | import org.swiftsuspenders.Injector; 12 | 13 | public class InjectOtherRuleResult extends InjectionResult 14 | { 15 | /******************************************************************************************* 16 | * private properties * 17 | *******************************************************************************************/ 18 | private var m_rule : InjectionConfig; 19 | 20 | 21 | /******************************************************************************************* 22 | * public methods * 23 | *******************************************************************************************/ 24 | public function InjectOtherRuleResult(rule : InjectionConfig) 25 | { 26 | m_rule = rule; 27 | } 28 | 29 | override public function getResponse(injector : Injector) : Object 30 | { 31 | return m_rule.getResponse(injector); 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /asunit-4.0/vendor/as3injection/org/swiftsuspenders/injectionresults/InjectSingletonResult.as: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 the original author or authors 3 | * 4 | * Permission is hereby granted to use, modify, and distribute this file 5 | * in accordance with the terms of the license agreement accompanying it. 6 | */ 7 | 8 | package org.swiftsuspenders.injectionresults 9 | { 10 | import org.swiftsuspenders.Injector; 11 | 12 | public class InjectSingletonResult extends InjectionResult 13 | { 14 | /******************************************************************************************* 15 | * private properties * 16 | *******************************************************************************************/ 17 | private var m_responseType : Class; 18 | private var m_response : Object; 19 | 20 | 21 | /******************************************************************************************* 22 | * public methods * 23 | *******************************************************************************************/ 24 | public function InjectSingletonResult(responseType : Class) 25 | { 26 | m_responseType = responseType; 27 | } 28 | 29 | override public function getResponse(injector : Injector) : Object 30 | { 31 | return m_response ||= createResponse(injector); 32 | } 33 | 34 | 35 | /******************************************************************************************* 36 | * private methods * 37 | *******************************************************************************************/ 38 | private function createResponse(injector : Injector) : Object 39 | { 40 | return injector.instantiate(m_responseType); 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /asunit-4.0/vendor/as3injection/org/swiftsuspenders/injectionresults/InjectValueResult.as: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 the original author or authors 3 | * 4 | * Permission is hereby granted to use, modify, and distribute this file 5 | * in accordance with the terms of the license agreement accompanying it. 6 | */ 7 | 8 | package org.swiftsuspenders.injectionresults 9 | { 10 | import org.swiftsuspenders.Injector; 11 | 12 | public class InjectValueResult extends InjectionResult 13 | { 14 | /******************************************************************************************* 15 | * private properties * 16 | *******************************************************************************************/ 17 | private var m_value : Object; 18 | 19 | 20 | /******************************************************************************************* 21 | * public methods * 22 | *******************************************************************************************/ 23 | public function InjectValueResult(value : Object) 24 | { 25 | m_value = value; 26 | } 27 | 28 | override public function getResponse(injector : Injector) : Object 29 | { 30 | return m_value; 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /asunit-4.0/vendor/as3injection/org/swiftsuspenders/injectionresults/InjectionResult.as: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 the original author or authors 3 | * 4 | * Permission is hereby granted to use, modify, and distribute this file 5 | * in accordance with the terms of the license agreement accompanying it. 6 | */ 7 | 8 | package org.swiftsuspenders.injectionresults 9 | { 10 | import org.swiftsuspenders.Injector; 11 | 12 | public class InjectionResult 13 | { 14 | /******************************************************************************************* 15 | * public methods * 16 | *******************************************************************************************/ 17 | public function InjectionResult() 18 | { 19 | } 20 | 21 | public function getResponse(injector : Injector) : Object 22 | { 23 | return null; 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /asunit-4.0/vendor/as3reflection/README: -------------------------------------------------------------------------------- 1 | These source files should be merged with the src path in the source 2 | distribution of AsUnit, but when compiling, developing and testing 3 | AsUnit, we should always build against the lib/Reflection.swc 4 | 5 | These files are being included simply to avoid making users add 6 | another SWC to their library-path. 7 | 8 | -------------------------------------------------------------------------------- /asunit-4.0/vendor/as3reflection/p2/reflect/ReflectionAccessor.as: -------------------------------------------------------------------------------- 1 | package p2.reflect { 2 | 3 | public class ReflectionAccessor extends ReflectionVariable { 4 | protected var _access:String; 5 | 6 | public function ReflectionAccessor(description:XML) { 7 | super(description); 8 | } 9 | 10 | public function get access():String { 11 | return _access ||= description.@access; 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /asunit-4.0/vendor/as3reflection/p2/reflect/ReflectionBase.as: -------------------------------------------------------------------------------- 1 | package p2.reflect { 2 | 3 | public class ReflectionBase { 4 | 5 | private var _description:XML; 6 | private var _metaDataItems:Array; 7 | private var _name:String; 8 | 9 | public function ReflectionBase(description:*) { 10 | _description = description; 11 | } 12 | 13 | public function get name():String { 14 | return _name ||= description.@name; 15 | } 16 | 17 | public function get description():XML { 18 | return _description; 19 | } 20 | 21 | public function get metaDataItems():Array { 22 | return _metaDataItems ||= parseMetaDataItems(); 23 | } 24 | 25 | public function toString():String { 26 | return description.toXMLString(); 27 | } 28 | 29 | public function getMetaDataByName(name:String):ReflectionMetaData { 30 | return findFirst(metaDataItems, function(item:*, index:int, items:Array):Boolean { 31 | return (item.name == name); 32 | }); 33 | } 34 | 35 | // Class metadata is stored in a different 36 | // location from member metadata... Boo. 37 | protected function getRawMetaData():XMLList { 38 | return description.metadata; 39 | } 40 | 41 | private function parseMetaDataItems():Array { 42 | var items:Array = []; 43 | var list:XMLList = getRawMetaData(); 44 | var item:XML; 45 | for each(item in list) { 46 | items.push(new ReflectionMetaData(item)); 47 | } 48 | return items; 49 | } 50 | } 51 | } 52 | 53 | -------------------------------------------------------------------------------- /asunit-4.0/vendor/as3reflection/p2/reflect/ReflectionMember.as: -------------------------------------------------------------------------------- 1 | package p2.reflect { 2 | 3 | public class ReflectionMember extends ReflectionBase { 4 | 5 | protected var _declaredBy:String; 6 | 7 | public function ReflectionMember(description:XML) { 8 | super(description); 9 | } 10 | 11 | public function get declaredBy():String { 12 | return _declaredBy ||= description.@declaredBy; 13 | } 14 | 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /asunit-4.0/vendor/as3reflection/p2/reflect/ReflectionMethod.as: -------------------------------------------------------------------------------- 1 | package p2.reflect { 2 | 3 | public class ReflectionMethod extends ReflectionMember { 4 | 5 | protected var _parameters:Array; 6 | protected var _returnType:String; 7 | 8 | public function ReflectionMethod(description:XML) { 9 | super(description); 10 | } 11 | 12 | private function buildParameters():Array { 13 | var parameters:Array = new Array(); 14 | var list:XMLList = description..parameter; 15 | var param:ReflectionMethodParameter; 16 | var item:XML; 17 | for each(item in list) { 18 | param = new ReflectionMethodParameter(item); 19 | parameters.push(param); 20 | } 21 | return parameters; 22 | } 23 | 24 | public function get returnType():String { 25 | return _returnType ||= description.@returnType; 26 | } 27 | 28 | public function get parameters():Array { 29 | if(_parameters == null) { 30 | _parameters = buildParameters(); 31 | } 32 | return _parameters; 33 | } 34 | } 35 | } 36 | 37 | -------------------------------------------------------------------------------- /asunit-4.0/vendor/as3reflection/p2/reflect/ReflectionMethodParameter.as: -------------------------------------------------------------------------------- 1 | package p2.reflect { 2 | 3 | public class ReflectionMethodParameter extends ReflectionVariable { 4 | protected var _index:int; 5 | protected var _optional:Boolean; 6 | 7 | public function ReflectionMethodParameter(description:XML) { 8 | super(description); 9 | } 10 | 11 | public function get index():int { 12 | return _index ||= description.@index; 13 | } 14 | 15 | public function get optional():Boolean { 16 | return _optional ||= (description.@optional == "true"); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /asunit-4.0/vendor/as3reflection/p2/reflect/ReflectionVariable.as: -------------------------------------------------------------------------------- 1 | package p2.reflect { 2 | 3 | public class ReflectionVariable extends ReflectionMember { 4 | 5 | protected var _type:String; 6 | 7 | public function ReflectionVariable(description:XML) { 8 | super(description); 9 | } 10 | 11 | public function get type():String { 12 | return _type ||= description.@type; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /asunit-4.0/vendor/as3reflection/p2/reflect/findFirst.as: -------------------------------------------------------------------------------- 1 | package p2.reflect { 2 | 3 | public function findFirst(collection:Array, handler:Function):* { 4 | var result:*; 5 | var len:Number = collection.length; 6 | for(var i:int; i < len; i++) { 7 | result = collection[i]; 8 | if(handler(result, i, collection)) { 9 | return result; 10 | } 11 | } 12 | } 13 | } 14 | 15 | -------------------------------------------------------------------------------- /asunit-4.0/vendor/generators/suite/USAGE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/patternpark/asunit/5bc790908714801e4fa16badd43d232b4200a60d/asunit-4.0/vendor/generators/suite/USAGE -------------------------------------------------------------------------------- /asunit-4.0/vendor/generators/suite/suite_generator.rb: -------------------------------------------------------------------------------- 1 | 2 | # Generate a new ActionScript 3.0 test suite 3 | # This generator can be executed as follows: 4 | # 5 | # sprout -n as3 SomeProject 6 | # cd SomeProject 7 | # script/generator suite 8 | # 9 | class SuiteGenerator < Sprout::Generator::NamedBase # :nodoc: 10 | 11 | def manifest 12 | record do |m| 13 | m.template 'TestSuite.as', File.join(test_dir, 'AllTests.as'), :collision => :force 14 | end 15 | end 16 | 17 | end 18 | -------------------------------------------------------------------------------- /asunit-4.0/vendor/generators/suite/templates/TestSuite.as: -------------------------------------------------------------------------------- 1 | package { 2 | /** 3 | * This file has been automatically created using 4 | * #!/usr/bin/ruby script/generate suite 5 | * If you modify it and run this script, your 6 | * modifications will be lost! 7 | */ 8 | <% test_case_classes.each do |test_case| %> 9 | import <%= test_case %>;<% end %> 10 | 11 | [Suite] 12 | public class AllTests { 13 | <% test_case_classes.each do |test_case| %> 14 | public var <%= test_case.gsub('.', '_') %>:<%= test_case %>;<% end %> 15 | } 16 | } 17 | 18 | --------------------------------------------------------------------------------