asunit4 4.2.2.pre → 4.2.3.pre
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile.lock +26 -0
- data/bin/AsUnit-4.1.2.swc +0 -0
- data/bin/AsUnit-4.2.3.pre.swc +0 -0
- data/bin/AsUnitRunner.swf +0 -0
- data/bin/Flex4AsUnitRunner.swf +0 -0
- data/build.xml +42 -2
- data/lib/SwiftSuspenders-v1.5.1.swc +0 -0
- data/lib/flexUnitTasks.jar +0 -0
- data/pkg/sprout-asunit4-library-4.1.2.gem +0 -0
- data/rakefile.rb +4 -1
- data/sprout/lib/asunit4.rb +1 -1
- data/src/asunit/asserts/assertMatches.as +6 -0
- data/src/asunit/asserts/assertThrowsWithMessage.as +5 -0
- data/src/asunit/core/AsUnitCore.as +42 -88
- data/src/asunit/core/FlashBuilderCore.as +2 -2
- data/src/asunit/core/FlashDevelopCore.as +1 -1
- data/src/asunit/core/FlexUnitCICore.as +17 -0
- data/src/asunit/core/TextCore.as +36 -54
- data/src/asunit/framework/Assert.as +76 -11
- data/src/asunit/framework/Async.as +1 -1
- data/src/asunit/framework/IResult.as +1 -6
- data/src/asunit/framework/IRunListener.as +0 -3
- data/src/asunit/framework/IRunner.as +0 -3
- data/src/asunit/framework/IRunnerFactory.as +3 -3
- data/src/asunit/framework/ITestListener.as +1 -2
- data/src/asunit/framework/Method.as +82 -80
- data/src/asunit/framework/Result.as +3 -24
- data/src/asunit/framework/RunnerFactory.as +13 -34
- data/src/asunit/framework/SuiteIterator.as +28 -22
- data/src/asunit/framework/TestCase.as +8 -3
- data/src/asunit/printers/FlashBuilderPrinter.as +25 -83
- data/src/asunit/printers/FlashDevelopPrinter.as +1 -2
- data/src/asunit/printers/FlexUnitCIPrinter.as +181 -0
- data/src/asunit/printers/TextPrinter.as +17 -46
- data/src/asunit/printers/XMLPrinter.as +127 -0
- data/src/asunit/runners/LegacyRunner.as +6 -1
- data/src/asunit/runners/SuiteRunner.as +30 -66
- data/src/asunit/runners/TestRunner.as +90 -255
- data/test/AllTests.as +9 -4
- data/test/AsUnitCIRunner.as +18 -0
- data/test/AsUnitRunner.as +2 -0
- data/test/AsUnitRunnerCS3.fla +0 -0
- data/test/asunit/core/AsUnitCoreTest.as +33 -15
- data/test/asunit/framework/AssertEqualsArraysIgnoringOrderTest.as +14 -0
- data/test/asunit/framework/AssertThrowsWithMessageTest.as +50 -0
- data/test/asunit/framework/AsyncTest.as +0 -4
- data/test/asunit/framework/ProceedOnEventTest.as +1 -2
- data/test/asunit/framework/ResultObserverTest.as +61 -0
- data/test/asunit/framework/RunnerFactoryTest.as +7 -9
- data/test/asunit/framework/VisualTestCaseTest.as +2 -26
- data/test/asunit/printers/FlashBuilderPrinterTest.as +18 -0
- data/test/asunit/printers/XMLPrinterTest.as +131 -0
- data/test/asunit/runners/LegacyRunnerTest.as +4 -4
- data/test/asunit/runners/SuiteRunnerTest.as +10 -7
- data/test/asunit/runners/TestRunnerAsyncMethodTest.as +9 -7
- data/test/asunit/runners/TestRunnerErrorMethodTest.as +1 -1
- data/test/asunit/runners/TestRunnerExpectsErrorTest.as +2 -2
- data/test/asunit/runners/TestRunnerExpectsErrorWithMessageTest.as +125 -0
- data/test/asunit/runners/TestRunnerIgnoredMethodTest.as +2 -3
- data/test/asunit/runners/TestRunnerTest.as +4 -27
- data/test/asunit/support/{CustomTestRunner.as → CustomSuiteRunner.as} +7 -3
- data/test/asunit/support/InjectionVerification.as +2 -30
- data/test/asunit/support/SuiteWithCustomRunner.as +1 -1
- data/vendor/as3injection/org/swiftsuspenders/InjectionConfig.as +78 -0
- data/vendor/as3injection/org/swiftsuspenders/InjectionType.as +16 -0
- data/vendor/as3injection/org/swiftsuspenders/Injector.as +376 -0
- data/vendor/as3injection/org/swiftsuspenders/InjectorError.as +17 -0
- data/vendor/as3injection/org/swiftsuspenders/Reflector.as +95 -0
- data/vendor/as3injection/org/swiftsuspenders/getConstructor.as +33 -0
- data/vendor/as3injection/org/swiftsuspenders/injectionpoints/ConstructorInjectionPoint.as +94 -0
- data/vendor/as3injection/org/swiftsuspenders/injectionpoints/InjectionPoint.as +35 -0
- data/vendor/as3injection/org/swiftsuspenders/injectionpoints/MethodInjectionPoint.as +122 -0
- data/vendor/as3injection/org/swiftsuspenders/injectionpoints/NoParamsConstructorInjectionPoint.as +24 -0
- data/vendor/as3injection/org/swiftsuspenders/injectionpoints/PostConstructInjectionPoint.as +52 -0
- data/vendor/as3injection/org/swiftsuspenders/injectionpoints/PropertyInjectionPoint.as +62 -0
- data/vendor/as3injection/org/swiftsuspenders/injectionresults/InjectClassResult.as +33 -0
- data/vendor/as3injection/org/swiftsuspenders/injectionresults/InjectOtherRuleResult.as +34 -0
- data/vendor/as3injection/org/swiftsuspenders/injectionresults/InjectSingletonResult.as +43 -0
- data/vendor/as3injection/org/swiftsuspenders/injectionresults/InjectValueResult.as +33 -0
- data/vendor/as3injection/org/swiftsuspenders/injectionresults/InjectionResult.as +26 -0
- metadata +44 -19
- data/bin/AsUnit-4.2.1.pre.swc +0 -0
- data/bin/AsUnit-4.2.2.pre.swc +0 -0
- data/src/asunit/framework/CallbackBridge.as +0 -175
- data/src/asunit/framework/ITestResult.as +0 -21
- data/src/asunit/framework/InjectionDelegate.as +0 -96
- data/src/asunit/framework/MessageBridge.as +0 -24
- data/src/asunit/framework/TestObserver.as +0 -12
- data/test/asunit/framework/CallbackBridgeTest.as +0 -73
- data/test/asunit/framework/InjectionDelegateTest.as +0 -79
- data/test/asunit/support/AnnotatedSubClass.as +0 -18
- data/test/asunit/support/AnnotatedSuperClass.as +0 -15
- data/test/asunit/support/FakeRunner.as +0 -32
- data/test/asunit/support/InjectTimeoutOnAsync.as +0 -14
- data/test/asunit/support/TestForFakeRunner.as +0 -14
@@ -111,6 +111,37 @@ package asunit.framework {
|
|
111
111
|
throw new AssertionFailedError("expected error type:<" + getQualifiedClassName(errorType) + "> but none was thrown." );
|
112
112
|
}
|
113
113
|
|
114
|
+
/**
|
115
|
+
* Asserts that the provided block throws an exception that matches
|
116
|
+
* the type and message provided.
|
117
|
+
*
|
118
|
+
* <listing>
|
119
|
+
* public function testFailingCode():void {
|
120
|
+
* assertThrows(CustomError, "Invalid state", function():void {
|
121
|
+
* var instance:Sprite = new Sprite();
|
122
|
+
* instance.callMethodThatThrows();
|
123
|
+
* });
|
124
|
+
* }
|
125
|
+
* </listing>
|
126
|
+
**/
|
127
|
+
static public function assertThrowsWithMessage(errorType:Class, errorMessage:String, block:Function):void {
|
128
|
+
try {
|
129
|
+
block.call();
|
130
|
+
}
|
131
|
+
catch(e:Error) {
|
132
|
+
if(!(e is errorType)) {
|
133
|
+
throw new AssertionFailedError("expected error type:<" + getQualifiedClassName(errorType)
|
134
|
+
+"> but was:<" + getQualifiedClassName(e) + ">");
|
135
|
+
}
|
136
|
+
if(e.message != errorMessage) {
|
137
|
+
throw new AssertionFailedError("expected error message:<" + errorMessage
|
138
|
+
+"> but was:<" + e.message + ">");
|
139
|
+
}
|
140
|
+
return;
|
141
|
+
}
|
142
|
+
throw new AssertionFailedError("expected error type:<" + getQualifiedClassName(errorType) + "> with message:<" + errorMessage + "> but none was thrown." );
|
143
|
+
}
|
144
|
+
|
114
145
|
/**
|
115
146
|
* Asserts that two objects are equal. If they are not
|
116
147
|
* an AssertionFailedError is thrown with the given message.
|
@@ -188,6 +219,30 @@ package asunit.framework {
|
|
188
219
|
throw new AssertionFailedError(message + "expected not null but was:<" + actual + ">");
|
189
220
|
}
|
190
221
|
}
|
222
|
+
|
223
|
+
static public function assertMatches(...args:Array):void {
|
224
|
+
var message:String;
|
225
|
+
var expr:RegExp;
|
226
|
+
var content:String;
|
227
|
+
|
228
|
+
if(args.length == 2) {
|
229
|
+
message = "";
|
230
|
+
expr = args[0];
|
231
|
+
content = args[1];
|
232
|
+
}
|
233
|
+
else if(args.length == 3) {
|
234
|
+
message = args[0];
|
235
|
+
expr = args[1];
|
236
|
+
content = args[2];
|
237
|
+
}
|
238
|
+
else {
|
239
|
+
throw new IllegalOperationError("Invalid argument count");
|
240
|
+
}
|
241
|
+
if(!content.match(expr)) {
|
242
|
+
fail("Unable to match [" + expr + "] in content: [" + content + "]");
|
243
|
+
}
|
244
|
+
}
|
245
|
+
|
191
246
|
/**
|
192
247
|
* Asserts that an object is null. If it is not
|
193
248
|
* an AssertionFailedError is thrown with the given message.
|
@@ -373,24 +428,34 @@ package asunit.framework {
|
|
373
428
|
if (expected.length != actual.length) {
|
374
429
|
failNotEquals(message, expected, actual);
|
375
430
|
}
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
431
|
+
|
432
|
+
var unusedPotentialMatches:Array = actual.slice();
|
433
|
+
|
434
|
+
var iLength:uint = expected.length;
|
435
|
+
var jLength:uint;
|
436
|
+
|
437
|
+
searchingForExpectedItems:
|
438
|
+
for (var i:int = 0; i < iLength; i++)
|
439
|
+
{
|
440
|
+
var expectedMember : Object = expected[i];
|
441
|
+
jLength = unusedPotentialMatches.length;
|
442
|
+
|
443
|
+
checkingAgainstActualItems:
|
444
|
+
for (var j : int = 0; j < jLength; j++) {
|
445
|
+
var actualMember : Object = unusedPotentialMatches[j];
|
381
446
|
try {
|
382
447
|
assertEquals(expectedMember, actualMember);
|
383
|
-
|
384
|
-
|
448
|
+
unusedPotentialMatches.splice(j, 1);
|
449
|
+
continue searchingForExpectedItems;
|
385
450
|
}
|
386
451
|
catch (e : AssertionFailedError) {
|
387
452
|
// no match, try next
|
388
453
|
}
|
389
454
|
}
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
455
|
+
|
456
|
+
failNotEquals("Found no match for " + expectedMember + ";", expected, actual);
|
457
|
+
|
458
|
+
}
|
394
459
|
}
|
395
460
|
|
396
461
|
static private function failNotEquals(message:String, expected:Object, actual:Object):void {
|
@@ -61,7 +61,7 @@ package asunit.framework {
|
|
61
61
|
}
|
62
62
|
|
63
63
|
/**
|
64
|
-
* Returns a new async handler that should be used as the
|
64
|
+
* Returns a new async handler that should be used as the listener of some
|
65
65
|
* presumably asynchronous event.
|
66
66
|
*
|
67
67
|
* You can optionally pass a function closure that you would like to have
|
@@ -1,15 +1,10 @@
|
|
1
1
|
package asunit.framework {
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
public interface IResult extends MessageBridge, IRunListener, ITestListener {
|
3
|
+
public interface IResult extends IRunListener, ITestListener {
|
6
4
|
|
7
5
|
function addListener(listener:IRunListener):void;
|
8
6
|
function removeListener(listener:IRunListener):void;
|
9
7
|
|
10
|
-
function addObserver(observer:TestObserver):void;
|
11
|
-
function shouldRunTest(testClass:Class):Boolean;
|
12
|
-
|
13
8
|
function get errors():Array;
|
14
9
|
function get errorCount():uint;
|
15
10
|
|
@@ -6,10 +6,7 @@ package asunit.framework {
|
|
6
6
|
public interface IRunner extends IEventDispatcher {
|
7
7
|
|
8
8
|
function run(testOrSuite:Class, testMethodName:String=null, visualContext:DisplayObjectContainer=null):void;
|
9
|
-
function shouldRunTest(testClass:Class):Boolean;
|
10
9
|
|
11
|
-
function set factory(factory:IRunnerFactory):void;
|
12
|
-
function get factory():IRunnerFactory;
|
13
10
|
}
|
14
11
|
}
|
15
12
|
|
@@ -1,9 +1,9 @@
|
|
1
1
|
package asunit.framework {
|
2
|
-
|
2
|
+
import org.swiftsuspenders.Injector;
|
3
3
|
|
4
4
|
public interface IRunnerFactory {
|
5
|
-
function get injector():
|
6
|
-
function set injector(value:
|
5
|
+
function get injector():Injector;
|
6
|
+
function set injector(value:Injector):void;
|
7
7
|
function runnerFor(testOrSuite:Class):IRunner;
|
8
8
|
}
|
9
9
|
}
|
@@ -1,9 +1,8 @@
|
|
1
1
|
package asunit.framework {
|
2
2
|
|
3
3
|
import asunit.framework.ITestFailure;
|
4
|
-
import asunit.framework.TestObserver;
|
5
4
|
|
6
|
-
public interface ITestListener
|
5
|
+
public interface ITestListener {
|
7
6
|
function onTestStarted(test:Object):void;
|
8
7
|
function onTestCompleted(test:Object):void;
|
9
8
|
function onTestFailure(failure:ITestFailure):void;
|
@@ -1,80 +1,82 @@
|
|
1
|
-
package asunit.framework {
|
2
|
-
|
3
|
-
import p2.reflect.Reflection;
|
4
|
-
import p2.reflect.ReflectionMethod;
|
5
|
-
import p2.reflect.ReflectionMetaData;
|
6
|
-
|
7
|
-
public class Method {
|
8
|
-
|
9
|
-
private var _scopeName:String;
|
10
|
-
|
11
|
-
public var expects:String;
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
public var
|
16
|
-
public var
|
17
|
-
public var
|
18
|
-
public var
|
19
|
-
public var
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
this.
|
24
|
-
this.
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
applyMetaData('
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
}
|
80
|
-
|
1
|
+
package asunit.framework {
|
2
|
+
|
3
|
+
import p2.reflect.Reflection;
|
4
|
+
import p2.reflect.ReflectionMethod;
|
5
|
+
import p2.reflect.ReflectionMetaData;
|
6
|
+
|
7
|
+
public class Method {
|
8
|
+
|
9
|
+
private var _scopeName:String;
|
10
|
+
|
11
|
+
public var expects:String;
|
12
|
+
public var message:String;
|
13
|
+
public var ignore:Boolean;
|
14
|
+
public var ignoreDescription:String;
|
15
|
+
public var metadata:ReflectionMetaData;
|
16
|
+
public var name:String;
|
17
|
+
public var order:int = 0;
|
18
|
+
public var scope:Object;
|
19
|
+
public var timeout:int = -1;
|
20
|
+
public var value:Function;
|
21
|
+
|
22
|
+
public function Method(scope:Object, reflection:ReflectionMethod) {
|
23
|
+
this.scope = scope;
|
24
|
+
this.name = reflection.name;
|
25
|
+
this.value = scope[reflection.name];
|
26
|
+
|
27
|
+
metadata = reflection.getMetaDataByName('Test');
|
28
|
+
|
29
|
+
if(metadata != null) {
|
30
|
+
var ignoreReflection:ReflectionMetaData = reflection.getMetaDataByName('Ignore');
|
31
|
+
if(ignoreReflection) {
|
32
|
+
ignore = true;
|
33
|
+
ignoreDescription = ignoreReflection.getValueFor('description');
|
34
|
+
}
|
35
|
+
|
36
|
+
handleTimeoutMetaData();
|
37
|
+
applyMetaData('expects');
|
38
|
+
applyMetaData('message');
|
39
|
+
applyMetaData('order');
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
public function get scopeName():String {
|
44
|
+
return _scopeName ||= Reflection.create(scope).name
|
45
|
+
}
|
46
|
+
|
47
|
+
private function handleTimeoutMetaData():void {
|
48
|
+
var value:* = metadata.getValueFor('timeout');
|
49
|
+
if(value != null) {
|
50
|
+
var message:String = "It seems you're using [Test(timeout=n)] for " + name + ", but this has been deprecated.\n";
|
51
|
+
message += "If you'd like to set a different timeout value, please send it to your Async instance methods like: async.add(null, timeoutInMilliseconds)";
|
52
|
+
trace("[DEPRECATION WARNING] " + message);
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
// The null response for timeout was updating the
|
57
|
+
// int field to zero when it needs to be -1...
|
58
|
+
private function applyMetaData(name:String):void {
|
59
|
+
var value:* = metadata.getValueFor(name);
|
60
|
+
if(value != null) {
|
61
|
+
this[name] = value;
|
62
|
+
}
|
63
|
+
}
|
64
|
+
|
65
|
+
public function execute():void {
|
66
|
+
value.call(scope);
|
67
|
+
}
|
68
|
+
|
69
|
+
public function get isTest():Boolean {
|
70
|
+
return (metadata != null || isLegacyTest);
|
71
|
+
}
|
72
|
+
|
73
|
+
public function get isLegacyTest():Boolean {
|
74
|
+
return (metadata == null && name.match(/^test/));
|
75
|
+
}
|
76
|
+
|
77
|
+
public function toString():String {
|
78
|
+
return name;
|
79
|
+
}
|
80
|
+
}
|
81
|
+
}
|
82
|
+
|
@@ -1,10 +1,6 @@
|
|
1
1
|
package asunit.framework {
|
2
|
-
|
3
|
-
|
4
|
-
import asunit.framework.ITestFailure;
|
5
|
-
|
6
|
-
import flash.events.EventDispatcher;
|
7
|
-
import flash.utils.Dictionary;
|
2
|
+
|
3
|
+
import asunit.errors.UsageError;
|
8
4
|
|
9
5
|
/**
|
10
6
|
* A <code>Result</code> collects the results of executing
|
@@ -15,7 +11,7 @@ package asunit.framework {
|
|
15
11
|
*
|
16
12
|
* @see Test
|
17
13
|
*/
|
18
|
-
public class Result
|
14
|
+
public class Result implements IResult {
|
19
15
|
|
20
16
|
protected var _runCount:uint = 0;
|
21
17
|
protected var _runTime:Number;
|
@@ -27,7 +23,6 @@ package asunit.framework {
|
|
27
23
|
|
28
24
|
protected var listeners:Array;
|
29
25
|
protected var runComplete:Boolean;
|
30
|
-
protected var knownTests:Dictionary;
|
31
26
|
|
32
27
|
public function Result() {
|
33
28
|
_errors = [];
|
@@ -36,7 +31,6 @@ package asunit.framework {
|
|
36
31
|
_successes = [];
|
37
32
|
_warnings = [];
|
38
33
|
listeners = [];
|
39
|
-
knownTests = new Dictionary();
|
40
34
|
}
|
41
35
|
|
42
36
|
public function get errors():Array { return _errors; }
|
@@ -72,21 +66,6 @@ package asunit.framework {
|
|
72
66
|
|
73
67
|
public function get runTime():Number { return _runTime; }
|
74
68
|
public function set runTime(value:Number):void { _runTime = value; }
|
75
|
-
|
76
|
-
public function shouldRunTest(testClass:Class):Boolean {
|
77
|
-
if(!knownTests[testClass]) {
|
78
|
-
knownTests[testClass] = testClass;
|
79
|
-
return true;
|
80
|
-
}
|
81
|
-
return false;
|
82
|
-
}
|
83
|
-
|
84
|
-
public function addObserver(observer:TestObserver):void {
|
85
|
-
if(!(observer is IRunListener)) {
|
86
|
-
throw new UsageError("Result.addObserver called with an instance that wasn't an IRunListener. This should work soon, but doesn't yet...");
|
87
|
-
}
|
88
|
-
addListener(IRunListener(observer));
|
89
|
-
}
|
90
69
|
|
91
70
|
public function addListener(listener:IRunListener):void {
|
92
71
|
if (listeners.indexOf(listener) >= 0) return;
|
@@ -9,7 +9,7 @@ package asunit.framework {
|
|
9
9
|
|
10
10
|
import p2.reflect.Reflection;
|
11
11
|
import p2.reflect.ReflectionMetaData;
|
12
|
-
import
|
12
|
+
import org.swiftsuspenders.Injector;
|
13
13
|
|
14
14
|
public class RunnerFactory implements IRunnerFactory {
|
15
15
|
|
@@ -34,21 +34,20 @@ package asunit.framework {
|
|
34
34
|
*/
|
35
35
|
public var DefaultSuiteRunner:Class;
|
36
36
|
|
37
|
-
public function RunnerFactory() {
|
37
|
+
public function RunnerFactory(injector:Injector = null) {
|
38
38
|
DefaultSuiteRunner = DEFAULT_SUITE_RUNNER;
|
39
39
|
DefaultTestRunner = DEFAULT_TEST_RUNNER;
|
40
|
-
injector = new
|
40
|
+
this.injector = injector ||= new Injector();
|
41
|
+
injector.mapValue(Injector, injector);
|
41
42
|
}
|
42
43
|
|
43
|
-
private var _injector:
|
44
|
+
private var _injector:Injector;
|
44
45
|
|
45
|
-
public function get injector():
|
46
|
-
{
|
46
|
+
public function get injector():Injector {
|
47
47
|
return _injector;
|
48
48
|
}
|
49
49
|
|
50
|
-
public function set injector(value:
|
51
|
-
{
|
50
|
+
public function set injector(value:Injector):void {
|
52
51
|
_injector = value;
|
53
52
|
}
|
54
53
|
|
@@ -56,7 +55,6 @@ package asunit.framework {
|
|
56
55
|
* runnerFor is the primary inerface to the RunnerFactory
|
57
56
|
*/
|
58
57
|
public function runnerFor(testOrSuite:Class):IRunner {
|
59
|
-
//trace(">> runnerFor: " + testOrSuite + " with current default of: " + DefaultTestRunner);
|
60
58
|
validate(testOrSuite);
|
61
59
|
return getRunnerForTestOrSuite(testOrSuite);
|
62
60
|
}
|
@@ -84,31 +82,21 @@ package asunit.framework {
|
|
84
82
|
}
|
85
83
|
|
86
84
|
protected function getRunnerForSuite(reflection:Reflection):IRunner {
|
87
|
-
//
|
88
|
-
|
89
|
-
var
|
90
|
-
if(Constructor) {
|
91
|
-
DefaultTestRunner = Constructor;
|
92
|
-
}
|
93
|
-
// Always return the default Suite Runner:
|
94
|
-
var runner:IRunner = new DefaultSuiteRunner();
|
95
|
-
configureRunner(runner);
|
85
|
+
// Use the provided RunWith class, or the DefaultSuiteRunner
|
86
|
+
var Constructor:Class = getRunWithConstructor(reflection) || DefaultSuiteRunner;
|
87
|
+
var runner:IRunner = injector.instantiate(Constructor);
|
96
88
|
return runner;
|
97
89
|
}
|
98
90
|
|
99
91
|
protected function getLegacyRunnerForTest(reflection:Reflection):IRunner {
|
100
|
-
var runner:IRunner =
|
101
|
-
configureRunner(runner);
|
92
|
+
var runner:IRunner = injector.instantiate(LegacyRunner);
|
102
93
|
return runner;
|
103
94
|
}
|
104
95
|
|
105
96
|
protected function getRunnerForTest(reflection:Reflection):IRunner {
|
106
|
-
// Use the provided RunWith class, or the DefaultTestRunner
|
107
|
-
// have been overridden by a parent Suite
|
97
|
+
// Use the provided RunWith class, or the DefaultTestRunner
|
108
98
|
var Constructor:Class = getRunWithConstructor(reflection) || DefaultTestRunner;
|
109
|
-
|
110
|
-
var runner:IRunner = new Constructor();
|
111
|
-
configureRunner(runner);
|
99
|
+
var runner:IRunner = injector.instantiate(Constructor);
|
112
100
|
return runner;
|
113
101
|
}
|
114
102
|
|
@@ -152,15 +140,6 @@ package asunit.framework {
|
|
152
140
|
}
|
153
141
|
return null;
|
154
142
|
}
|
155
|
-
|
156
|
-
/**
|
157
|
-
* @private
|
158
|
-
*/
|
159
|
-
protected function configureRunner(runner:IRunner):void
|
160
|
-
{
|
161
|
-
runner.factory = this;
|
162
|
-
injector.updateInjectionPoints(runner, InjectionDelegate.THROW_ERROR_ON_MISSING_INJECTION_POINT);
|
163
|
-
}
|
164
143
|
|
165
144
|
public static function isSuite(reflection:Reflection):Boolean {
|
166
145
|
return (reflection.getMetaDataByName('Suite') != null);
|