You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by er...@apache.org on 2014/12/10 13:56:07 UTC

[01/13] git commit: [flex-sdk] [refs/heads/develop] - Initial commit of Promises package (incl. FlexUnit tests)

Repository: flex-sdk
Updated Branches:
  refs/heads/develop 4ca22ecd4 -> 5620f8109


Initial commit of Promises package (incl. FlexUnit tests)

Signed-off-by: Erik de Bruin <er...@ixsoftware.nl>


Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/6dc8070f
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/6dc8070f
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/6dc8070f

Branch: refs/heads/develop
Commit: 6dc8070ffcd76280ec3bee2b00945c56bcc950e9
Parents: 4ca22ec
Author: Erik de Bruin <er...@ixsoftware.nl>
Authored: Tue Dec 9 09:34:02 2014 +0100
Committer: Erik de Bruin <er...@ixsoftware.nl>
Committed: Wed Dec 10 13:30:03 2014 +0100

----------------------------------------------------------------------
 .../src/org/apache/flex/promises/Promise.as     | 277 ++++++++++++++++++
 .../apache/flex/promises/enums/PromiseState.as  |  52 ++++
 .../apache/flex/promises/interfaces/IPromise.as |  30 ++
 .../flex/promises/interfaces/IThenable.as       |  30 ++
 .../src/org/apache/flex/promises/vo/Handler.as  |  68 +++++
 .../src/tests/promises/PromisesTestSuite.as     |  33 +++
 .../tests/promises/cases/PromisesBasicTests.as  | 289 +++++++++++++++++++
 7 files changed, 779 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/6dc8070f/frameworks/projects/apache/src/org/apache/flex/promises/Promise.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/apache/src/org/apache/flex/promises/Promise.as b/frameworks/projects/apache/src/org/apache/flex/promises/Promise.as
new file mode 100644
index 0000000..bfc62fa
--- /dev/null
+++ b/frameworks/projects/apache/src/org/apache/flex/promises/Promise.as
@@ -0,0 +1,277 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package org.apache.flex.promises
+{
+
+import flash.events.TimerEvent;
+import flash.utils.Timer;
+
+import org.apache.flex.promises.enums.PromiseState;
+import org.apache.flex.promises.interfaces.IPromise;
+import org.apache.flex.promises.vo.Handler;
+
+public class Promise implements IPromise
+{
+
+
+	//--------------------------------------------------------------------------
+	//
+	//    Constructor
+	//
+	//--------------------------------------------------------------------------
+	
+	public function Promise(resolver:Function) {
+		this.handlers_ = new Vector.<Handler>();
+		
+		this.state_ = PromiseState.PENDING;
+		
+		this.doResolve_(resolver, this.resolve_, this.reject_);
+	}
+
+
+
+	//--------------------------------------------------------------------------
+	//
+	//    Variables
+	//
+	//--------------------------------------------------------------------------
+	
+	private var handlers_:Vector.<Handler>;
+	
+	private var state_:PromiseState;
+	
+	private var value_:*;
+	
+	
+	
+	//--------------------------------------------------------------------------
+	//
+	//    Methods
+	//
+	//--------------------------------------------------------------------------
+	
+	//----------------------------------
+	//    done
+	//----------------------------------
+	
+	public function done(onFulfilled:Function = null, onRejected:Function = null):void
+	{
+		//var self:Promise = this;
+		
+		//var timer:Timer = new Timer(0, 1);
+		//timer.addEventListener(TimerEvent.TIMER, function ():void {
+			this.handle_(new Handler(onFulfilled, onRejected));
+		//});
+		//timer.start();
+	}
+	
+	//----------------------------------
+	//    doResolve_
+	//----------------------------------
+	
+	private function doResolve_(fn:Function, onFulfilled:Function, onRejected:Function):void
+	{
+		var done:Boolean = false;
+		
+		try
+		{
+			fn(function (value:*):void {
+				if (done)
+				{
+					return;
+				}
+				
+				done = true;
+				
+				onFulfilled(value);
+			}, function (reason:*):void {
+				if (done)
+				{
+					return;
+				}
+				
+				done = true;
+				
+				onRejected(reason);
+			});
+		}
+		catch (e:Error)
+		{
+			if (done)
+			{
+				return;
+			}
+			
+			done = true;
+			
+			onRejected(e);
+		}
+	}
+	
+	//----------------------------------
+	//    getThen_
+	//----------------------------------
+	
+	private function getThen_(value:*):Function
+	{
+		var type:String = typeof value;
+		
+		if (value && (value === 'object' || value === 'function'))
+		{
+			var then:* = value.then;
+			
+			if (then is Function)
+			{
+				return then;
+			}
+		}
+		
+		return null;
+	}
+	
+	//----------------------------------
+	//    fulfill_
+	//----------------------------------
+	
+	private function fulfill_(result:*):void
+	{
+		this.state_ = PromiseState.FULFILLED;
+		
+		this.value_ = result;
+		
+		this.handlers_.forEach(this.handle_);
+		
+		this.handlers_ = null;
+	}
+	
+	//----------------------------------
+	//    handle_
+	//----------------------------------
+	
+	private function handle_(handler:Object, ...rest):void
+	{
+		if (this.state_ === PromiseState.PENDING)
+		{
+			trace(this.state_);
+			this.handlers_.push(handler);
+		}
+		else
+		{
+			if (this.state_ === PromiseState.FULFILLED && handler.onFulfilled != null)
+			{
+				handler.onFulfilled(this.value_);
+			}
+			
+			if (this.state_ === PromiseState.REJECTED && handler.onRejected != null)
+			{
+				handler.onRejected(this.value_);
+			}
+		}
+	}
+	
+	//----------------------------------
+	//    reject_
+	//----------------------------------
+	
+	private function reject_(error:*):void
+	{
+		this.state_ = PromiseState.REJECTED;
+		
+		this.value_ = error;
+		
+		this.handlers_.forEach(this.handle_);
+		
+		this.handlers_ = null;
+	}
+	
+	//----------------------------------
+	//    resolve_
+	//----------------------------------
+	
+	private function resolve_(result:*):void
+	{
+		try 
+		{
+			var then:Function = this.getThen_(result);
+			
+			if (then != null) {
+				this.doResolve_(then, this.resolve_, this.reject_);
+				
+				return;
+			}
+			
+			this.fulfill_(result);
+		}
+		catch (e:Error)
+		{
+			this.reject_(e);
+		}
+	}
+
+	//----------------------------------
+	//    then
+	//----------------------------------
+
+	public function then(onFulfilled:Function = null, 
+						 onRejected:Function = null):IPromise
+	{
+		var self:IPromise = this;
+		
+		var resolver:Function = function (resolve:Function, reject:Function):* {
+			return self.done(function (result:*):* {
+				if (onFulfilled is Function)
+				{
+					try
+					{
+						return resolve(onFulfilled(result));
+					}
+					catch (e:Error)
+					{
+						return reject(e);
+					}
+				}
+				else
+				{
+					return resolve(result);
+				}
+			}, function (error:*):* {
+				if (onRejected is Function)
+				{
+					try
+					{
+						return resolve(onRejected(error));
+					}
+					catch (e:Error)
+					{
+						return reject(e);
+					}
+				}
+				else
+				{
+					return reject(error);
+				}
+			});
+		};
+		
+		return new Promise(resolver);
+	}
+
+}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/6dc8070f/frameworks/projects/apache/src/org/apache/flex/promises/enums/PromiseState.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/apache/src/org/apache/flex/promises/enums/PromiseState.as b/frameworks/projects/apache/src/org/apache/flex/promises/enums/PromiseState.as
new file mode 100644
index 0000000..d44e65e
--- /dev/null
+++ b/frameworks/projects/apache/src/org/apache/flex/promises/enums/PromiseState.as
@@ -0,0 +1,52 @@
+package org.apache.flex.promises.enums
+{
+
+public class PromiseState
+{
+    
+    //--------------------------------------------------------------------------
+    //
+    //    Class constants
+    //
+    //--------------------------------------------------------------------------
+    
+	public static const BLOCKED:PromiseState = new PromiseState("blocked");
+	public static const FULFILLED:PromiseState = new PromiseState("fulfilled");
+	public static const PENDING:PromiseState = new PromiseState("pending");
+	public static const REJECTED:PromiseState = new PromiseState("rejected");
+	
+    //--------------------------------------------------------------------------
+    //
+    //    Constructor
+    //
+    //--------------------------------------------------------------------------
+    
+    public function PromiseState(stringValue:String) {
+        this.stringValue = stringValue;
+    }
+    
+    //--------------------------------------------------------------------------
+    //
+    //    Variables
+    //
+    //--------------------------------------------------------------------------
+    
+    private var stringValue:String;
+    
+    //--------------------------------------------------------------------------
+    //
+    //    Methods
+    //
+    //--------------------------------------------------------------------------
+    
+    //----------------------------------
+    //    toString
+    //----------------------------------
+    
+    public function toString():String
+    {
+        return stringValue;
+    }
+    
+}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/6dc8070f/frameworks/projects/apache/src/org/apache/flex/promises/interfaces/IPromise.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/apache/src/org/apache/flex/promises/interfaces/IPromise.as b/frameworks/projects/apache/src/org/apache/flex/promises/interfaces/IPromise.as
new file mode 100644
index 0000000..7c70b14
--- /dev/null
+++ b/frameworks/projects/apache/src/org/apache/flex/promises/interfaces/IPromise.as
@@ -0,0 +1,30 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package org.apache.flex.promises.interfaces
+{
+
+public interface IPromise extends IThenable
+{
+
+	function done(onFulfilled:Function = null, onRejected:Function = null):void;
+	
+}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/6dc8070f/frameworks/projects/apache/src/org/apache/flex/promises/interfaces/IThenable.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/apache/src/org/apache/flex/promises/interfaces/IThenable.as b/frameworks/projects/apache/src/org/apache/flex/promises/interfaces/IThenable.as
new file mode 100644
index 0000000..d154d70
--- /dev/null
+++ b/frameworks/projects/apache/src/org/apache/flex/promises/interfaces/IThenable.as
@@ -0,0 +1,30 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package org.apache.flex.promises.interfaces
+{
+
+public interface IThenable
+{
+
+	function then(onFulfilled:Function = null, onRejected:Function = null):IPromise;
+	
+}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/6dc8070f/frameworks/projects/apache/src/org/apache/flex/promises/vo/Handler.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/apache/src/org/apache/flex/promises/vo/Handler.as b/frameworks/projects/apache/src/org/apache/flex/promises/vo/Handler.as
new file mode 100644
index 0000000..d57385c
--- /dev/null
+++ b/frameworks/projects/apache/src/org/apache/flex/promises/vo/Handler.as
@@ -0,0 +1,68 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package org.apache.flex.promises.vo
+{
+
+public final class Handler
+{
+
+	//--------------------------------------------------------------------------
+	//
+	//    Constructor
+	//
+	//--------------------------------------------------------------------------
+	
+	public function Handler(onFulfilled:Function = null, 
+							onRejected:Function = null) 
+	{
+		if (onFulfilled != null)
+		{
+			this.onFulfilled = onFulfilled;
+		}
+		
+		if (onRejected != null)
+		{
+			this.onRejected = onRejected;
+		}
+	}
+	
+
+
+	//--------------------------------------------------------------------------
+	//
+	//    Properties
+	//
+	//--------------------------------------------------------------------------
+	
+	//----------------------------------
+	//    onFulfilled
+	//----------------------------------
+	
+	public var onFulfilled:Function;
+	
+	//----------------------------------
+	//    onRejected
+	//----------------------------------
+	
+	public var onRejected:Function;
+	
+}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/6dc8070f/frameworks/projects/apache/src/tests/promises/PromisesTestSuite.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/apache/src/tests/promises/PromisesTestSuite.as b/frameworks/projects/apache/src/tests/promises/PromisesTestSuite.as
new file mode 100644
index 0000000..57d6766
--- /dev/null
+++ b/frameworks/projects/apache/src/tests/promises/PromisesTestSuite.as
@@ -0,0 +1,33 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package tests.promises
+{
+
+import tests.promises.cases.PromisesBasicTests;
+
+[Suite]
+[RunWith("org.flexunit.runners.Suite")]
+public class PromisesTestSuite
+{
+
+	public var promisesBasic:PromisesBasicTests;
+
+}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/6dc8070f/frameworks/projects/apache/src/tests/promises/cases/PromisesBasicTests.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/apache/src/tests/promises/cases/PromisesBasicTests.as b/frameworks/projects/apache/src/tests/promises/cases/PromisesBasicTests.as
new file mode 100644
index 0000000..494ff86
--- /dev/null
+++ b/frameworks/projects/apache/src/tests/promises/cases/PromisesBasicTests.as
@@ -0,0 +1,289 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package tests.promises.cases
+{
+
+import flash.events.TimerEvent;
+import flash.utils.Timer;
+import flash.utils.setTimeout;
+
+import flexunit.framework.Assert;
+
+import org.apache.flex.promises.Promise;
+import org.apache.flex.promises.interfaces.IPromise;
+import org.apache.flex.promises.interfaces.IThenable;
+import org.flexunit.asserts.assertEquals;
+import org.flexunit.asserts.assertNotNull;
+import org.flexunit.asserts.assertTrue;
+import org.flexunit.async.Async;
+
+public class PromisesBasicTests
+{
+
+	//--------------------------------------------------------------------------
+	//
+	//    Variables
+	//
+	//--------------------------------------------------------------------------
+	
+	private var expected_:*;
+	
+	private var promise_:IPromise;
+	
+	private var got_:*;
+	
+	private var timer_:Timer;
+	
+	
+	
+	//--------------------------------------------------------------------------
+	//
+	//    Methods
+	//
+	//--------------------------------------------------------------------------
+	
+	//----------------------------------
+	//    parseErrorGot_
+	//----------------------------------
+	
+	private function parseErrorGot_(value:*):void {
+		this.got_ = Error(value).message;
+	}
+	
+	//----------------------------------
+	//    parseGot_
+	//----------------------------------
+	
+	private function parseGot_(value:*):void {
+		this.got_ = value;
+	}
+	
+	//----------------------------------
+	//    setUp
+	//----------------------------------
+	
+	[Before(async)]
+	public function setUp():void
+	{
+		this.timer_ = new Timer(100, 1);
+	}
+	
+	//----------------------------------
+	//    tearDown
+	//----------------------------------
+	
+	[After(async)]
+	public function tearDown():void
+	{
+		this.promise_ = null;
+		
+		if (this.timer_)
+		{
+			this.timer_.stop();
+			this.timer_ = null;
+		}
+	}
+	
+	//----------------------------------
+	//    verifyGot_
+	//----------------------------------
+	
+	private function verifyGot_(event:TimerEvent, result:*):void {
+		assertEquals(this.expected_, this.got_);
+	}
+	
+
+	
+	//--------------------------------------------------------------------------
+	//
+	//    Tests
+	//
+	//--------------------------------------------------------------------------
+	
+	//----------------------------------
+	//    test_Create
+	//----------------------------------
+	
+	[Test]
+	public function test_Create():void
+	{
+		promise_ = new Promise(null);
+		
+		Assert.assertNotUndefined(promise_);
+		
+		assertNotNull(promise_);
+		
+		assertTrue(promise_ is IThenable);
+		assertTrue(promise_ is IPromise);
+		assertTrue(promise_ is Promise);
+	}
+	
+	//----------------------------------
+	//    test_SimpleSyncDone_FulFill
+	//----------------------------------
+	
+	[Test(async)]
+	public function test_SimpleSyncDone_FulFill():void
+	{
+		Async.handleEvent(this, timer_, TimerEvent.TIMER_COMPLETE, verifyGot_);
+		
+		timer_.start();
+		
+		promise_ = new Promise(function (fulfill:Function = null, reject:Function = null):*
+		{
+			fulfill('Hello world');
+		});
+		
+		expected_ = 'Hello world';
+		promise_.done(parseGot_);
+	}
+	
+	//----------------------------------
+	//    test_SimpleSyncDone_Reject
+	//----------------------------------
+	
+	[Test(async)]
+	public function test_SimpleSyncDone_Reject():void
+	{
+		Async.handleEvent(this, timer_, TimerEvent.TIMER_COMPLETE, verifyGot_);
+		
+		timer_.start();
+		
+		promise_ = new Promise(function (fulfill:Function = null, reject:Function = null):*
+		{
+			reject(new Error('reject'));
+		});
+		
+		expected_ = 'Error: reject';
+		promise_.done(null, parseErrorGot_);
+	}
+	
+	//----------------------------------
+	//    test_SimpleSyncThen_FulFill
+	//----------------------------------
+	
+	[Test(async)]
+	public function test_SimpleSyncThen_FulFill():void
+	{
+		Async.handleEvent(this, timer_, TimerEvent.TIMER_COMPLETE, verifyGot_);
+		
+		timer_.start();
+		
+		promise_ = new Promise(function (fulfill:Function = null, reject:Function = null):*
+		{
+			fulfill('Hello world');
+		});
+		
+		expected_ = 'Hello world';
+		promise_.then(parseGot_);
+	}
+	
+	//----------------------------------
+	//    test_SimpleSyncThen_Reject
+	//----------------------------------
+	
+	[Test(async)]
+	public function test_SimpleSyncThen_Reject():void
+	{
+		Async.handleEvent(this, timer_, TimerEvent.TIMER_COMPLETE, verifyGot_);
+		
+		timer_.start();
+		
+		promise_ = new Promise(function (fulfill:Function = null, reject:Function = null):*
+		{
+			reject(new Error('reject'));
+		});
+		
+		expected_ = 'Error: reject';
+		promise_.then(null, parseErrorGot_);
+	}
+	
+	//----------------------------------
+	//    test_SimpleASyncThen_FulFill
+	//----------------------------------
+	
+	[Test(async)]
+	public function test_SimpleASyncThen_FulFill():void
+	{
+		Async.handleEvent(this, timer_, TimerEvent.TIMER_COMPLETE, verifyGot_);
+		
+		timer_.start();
+		
+		this.promise_ = new Promise(function (fulfill:Function = null, 
+											  reject:Function = null):*
+		{
+			setTimeout(function ():void { fulfill('Hello world'); }, 0);
+		});
+		
+		expected_ = 'Hello world';
+		promise_.then(parseGot_);
+	}
+	
+	//----------------------------------
+	//    test_SimpleASyncThen_Reject
+	//----------------------------------
+	
+	[Test(async)]
+	public function test_SimpleASyncThen_Reject():void
+	{
+		Async.handleEvent(this, timer_, TimerEvent.TIMER_COMPLETE, verifyGot_);
+		
+		timer_.start();
+		
+		this.promise_ = new Promise(function (fulfill:Function = null, 
+											  reject:Function = null):*
+		{
+			setTimeout(function ():void { reject(new Error('reject')); }, 0);
+		});
+		
+		expected_ = 'Error: reject';
+		promise_.then(null, parseErrorGot_);
+	}
+	
+	
+	//----------------------------------
+	//    test_MultipleASyncThen_FulFill
+	//----------------------------------
+	
+	[Test(async)]
+	public function test_MultipleASyncThen_FulFill():void
+	{
+		Async.handleEvent(this, timer_, TimerEvent.TIMER_COMPLETE, verifyGot_);
+		
+		timer_.start();
+		
+		var anotherStep:Function = function (value:*):IPromise
+		{
+			return new Promise(function (fulfill:Function = null, reject:Function = null):*
+			{
+				setTimeout(function ():void { fulfill(value + ' ... again'); }, 0);
+			});
+		}
+		
+		promise_ = new Promise(function (fulfill:Function = null, reject:Function = null):*
+		{
+			setTimeout(function ():void { fulfill('Hello world'); }, 0);
+		});
+		
+		expected_ = 'Hello worlds ... again';
+		promise_.then(anotherStep).then(parseGot_);
+	}
+	
+}}
\ No newline at end of file


[13/13] git commit: [flex-sdk] [refs/heads/develop] - Clean old reports before running tests

Posted by er...@apache.org.
Clean old reports before running tests

Signed-off-by: Erik de Bruin <er...@ixsoftware.nl>


Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/b67b0fe4
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/b67b0fe4
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/b67b0fe4

Branch: refs/heads/develop
Commit: b67b0fe4ea15a3b53a5401fb63c3a828ac361268
Parents: 39a2f2f
Author: Erik de Bruin <er...@ixsoftware.nl>
Authored: Wed Dec 10 13:09:05 2014 +0100
Committer: Erik de Bruin <er...@ixsoftware.nl>
Committed: Wed Dec 10 13:30:06 2014 +0100

----------------------------------------------------------------------
 frameworks/build.xml | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b67b0fe4/frameworks/build.xml
----------------------------------------------------------------------
diff --git a/frameworks/build.xml b/frameworks/build.xml
index c6cbac8..541f92f 100644
--- a/frameworks/build.xml
+++ b/frameworks/build.xml
@@ -136,6 +136,8 @@
     </target>
 	
     <target name="test" description="Runs the tests for all projects that have FlexUnit tests">
+        <delete dir="${FLEX_HOME}/test-reports"/>
+
         <antcall target="apache-test"/>
     </target>
 


[07/13] git commit: [flex-sdk] [refs/heads/develop] - Add 'flexunit-tests.xml' utility ant script

Posted by er...@apache.org.
Add 'flexunit-tests.xml' utility ant script

Signed-off-by: Erik de Bruin <er...@ixsoftware.nl>


Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/908f99d2
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/908f99d2
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/908f99d2

Branch: refs/heads/develop
Commit: 908f99d20f2dd783053c03d5fe78f624b37e0550
Parents: dc7dc47
Author: Erik de Bruin <er...@ixsoftware.nl>
Authored: Wed Dec 10 11:14:45 2014 +0100
Committer: Erik de Bruin <er...@ixsoftware.nl>
Committed: Wed Dec 10 13:30:05 2014 +0100

----------------------------------------------------------------------
 flexunit-tests.xml | 102 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 102 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/908f99d2/flexunit-tests.xml
----------------------------------------------------------------------
diff --git a/flexunit-tests.xml b/flexunit-tests.xml
new file mode 100644
index 0000000..3bb135f
--- /dev/null
+++ b/flexunit-tests.xml
@@ -0,0 +1,102 @@
+<?xml version="1.0"?>
+<!--
+
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+-->
+
+<project name="flexunit-tests" default="test">
+
+  <property name="FLEX_HOME" location="${basedir}"/>
+  <property name="FLEXUNIT_HOME" value="${FLEX_HOME}/../flex-flexunit"/>
+
+  <property name="exit" value="false"/>
+  
+  <target name="test" depends="test-check,test-run,test-clean"
+    description="Runs FlexUnit tests"/>
+
+  <target name="test-check">
+
+    <available
+      type="dir" file="${FLEXUNIT_HOME}" 
+      property="FLEXUNIT_HOME.set" />
+
+    <fail message="The FLEXUNIT_HOME variable is not set to a directory" 
+        unless="FLEXUNIT_HOME.set"/>
+
+    <echo message="FLEXUNIT_HOME is set: ${FLEXUNIT_HOME}"/>
+
+    <available
+      type="dir" file="${project.root}" 
+      property="project.root.set" />
+
+    <fail message="The 'project.root' variable is not set to a directory" 
+        unless="project.root.set"/>
+
+    <echo message="'project.root' is set: ${project.root}"/>
+
+  </target>
+  
+  <target name="test-run" unless="${exit}">
+
+    <property name="tests.bin" location="${FLEX_HOME}/bin-tests"/>
+
+    <taskdef resource="flexUnitTasks.tasks">
+      <classpath>
+        <fileset dir="${FLEXUNIT_HOME}/FlexUnit4AntTasks/target">
+          <include name="flexUnitTasks*.jar"/>
+        </fileset>
+      </classpath>
+    </taskdef>
+
+    <echo message="Unit tests for '${project.root}'"/>
+
+    <mkdir dir="${tests.bin}"/>
+
+    <flexunit
+      workingDir="${tests.bin}" 
+      toDir="${tests.bin}/report" 
+      haltonfailure="false" 
+      verbose="true" 
+      localTrusted="true">
+      
+      <source dir="${project.root}/src"/>
+      
+      <testSource dir="${project.root}/src">
+        <include name="**/*Tests.as"/>
+      </testSource>
+      
+      <library dir="${FLEXUNIT_HOME}/FlexUnit4/target"/>
+      <library dir="${FLEXUNIT_HOME}/FlexUnit4CIListener/target"/>
+    </flexunit>
+
+  </target>
+
+  <target name="test-clean" unless="${exit}">
+
+    <echo message="Clean up test artefacts"/>
+
+    <delete dir="${tests.bin}"/>
+
+    <delete>
+      <fileset dir="${project.root}">
+        <include name="TEST-*.xml" />
+      </fileset>
+    </delete>
+
+  </target>
+  
+</project>
\ No newline at end of file


[12/13] git commit: [flex-sdk] [refs/heads/develop] - Create generated test artefacts in project dir, not the SDK root dir

Posted by er...@apache.org.
Create generated test artefacts in project dir, not the SDK root dir

Signed-off-by: Erik de Bruin <er...@ixsoftware.nl>


Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/5620f810
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/5620f810
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/5620f810

Branch: refs/heads/develop
Commit: 5620f81093fdb051b397e3387687da1afd004652
Parents: b67b0fe
Author: Erik de Bruin <er...@ixsoftware.nl>
Authored: Wed Dec 10 13:13:33 2014 +0100
Committer: Erik de Bruin <er...@ixsoftware.nl>
Committed: Wed Dec 10 13:30:06 2014 +0100

----------------------------------------------------------------------
 flexunit-tests.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/5620f810/flexunit-tests.xml
----------------------------------------------------------------------
diff --git a/flexunit-tests.xml b/flexunit-tests.xml
index 98c80ff..8681b86 100644
--- a/flexunit-tests.xml
+++ b/flexunit-tests.xml
@@ -52,7 +52,7 @@
   
   <target name="test-run" unless="${exit}">
 
-    <property name="tests.bin" location="${FLEX_HOME}/bin-tests"/>
+    <property name="tests.bin" location="${basedir}/bin-tests"/>
 
     <taskdef resource="flexUnitTasks.tasks">
       <classpath>


[11/13] git commit: [flex-sdk] [refs/heads/develop] - Copy all test reports to central location, for easy access from Jenkins

Posted by er...@apache.org.
Copy all test reports to central location, for easy access from Jenkins

Signed-off-by: Erik de Bruin <er...@ixsoftware.nl>


Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/39a2f2f5
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/39a2f2f5
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/39a2f2f5

Branch: refs/heads/develop
Commit: 39a2f2f53dd19fd0a6bb24a850dfaa62c7ae4417
Parents: 1bd39ac
Author: Erik de Bruin <er...@ixsoftware.nl>
Authored: Wed Dec 10 13:08:21 2014 +0100
Committer: Erik de Bruin <er...@ixsoftware.nl>
Committed: Wed Dec 10 13:30:05 2014 +0100

----------------------------------------------------------------------
 flexunit-tests.xml | 8 ++++++++
 1 file changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/39a2f2f5/flexunit-tests.xml
----------------------------------------------------------------------
diff --git a/flexunit-tests.xml b/flexunit-tests.xml
index 3bb135f..98c80ff 100644
--- a/flexunit-tests.xml
+++ b/flexunit-tests.xml
@@ -83,6 +83,14 @@
       <library dir="${FLEXUNIT_HOME}/FlexUnit4CIListener/target"/>
     </flexunit>
 
+    <mkdir dir="${FLEX_HOME}/test-reports"/>
+
+    <copy todir="${FLEX_HOME}/test-reports">
+      <fileset dir="${project.root}">
+        <include name="TEST-*.xml" />
+      </fileset>
+    </copy>
+
   </target>
 
   <target name="test-clean" unless="${exit}">


[10/13] git commit: [flex-sdk] [refs/heads/develop] - Add 'test-reports' directory and a header comment

Posted by er...@apache.org.
Add 'test-reports' directory and a header comment

Signed-off-by: Erik de Bruin <er...@ixsoftware.nl>


Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/1bd39ac2
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/1bd39ac2
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/1bd39ac2

Branch: refs/heads/develop
Commit: 1bd39ac24b2927caada3bcd9fcf8e8fa7510a49d
Parents: 3927236
Author: Erik de Bruin <er...@ixsoftware.nl>
Authored: Wed Dec 10 13:07:12 2014 +0100
Committer: Erik de Bruin <er...@ixsoftware.nl>
Committed: Wed Dec 10 13:30:05 2014 +0100

----------------------------------------------------------------------
 .gitignore | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/1bd39ac2/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 72f6ada..03d57dc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -137,4 +137,7 @@ air-sdk-description.xml
 samples/descriptor-sample.xml
 include/FlashRuntimeExtensions.h
 visualcomps
+
+#FlexUnit tests
+test-reports
 FlexUnitCompilerApplication.mxml
\ No newline at end of file


[08/13] git commit: [flex-sdk] [refs/heads/develop] - Add 'test' target to 'org.apache.flex' project build script

Posted by er...@apache.org.
Add 'test' target to 'org.apache.flex' project build script

Signed-off-by: Erik de Bruin <er...@ixsoftware.nl>


Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/c72d8016
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/c72d8016
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/c72d8016

Branch: refs/heads/develop
Commit: c72d8016bf817706581460ef4385e89607bb829b
Parents: 908f99d
Author: Erik de Bruin <er...@ixsoftware.nl>
Authored: Wed Dec 10 11:17:10 2014 +0100
Committer: Erik de Bruin <er...@ixsoftware.nl>
Committed: Wed Dec 10 13:30:05 2014 +0100

----------------------------------------------------------------------
 frameworks/projects/apache/build.xml | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/c72d8016/frameworks/projects/apache/build.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/apache/build.xml b/frameworks/projects/apache/build.xml
index 363e896..07577b9 100644
--- a/frameworks/projects/apache/build.xml
+++ b/frameworks/projects/apache/build.xml
@@ -188,6 +188,12 @@
 		</compc>
 	</target>
 	
+  <target name="test" description="Runs FlexUnit tests for 'org.apache.flex' components">
+    <ant antfile="${FLEX_HOME}/flexunit-tests.xml">
+      <property name="project.root" value="${basedir}"/>
+    </ant>
+  </target>
+	
 	<target name="doc" depends="clean-temp-docs" description="updates apache.swc with asdoc xml">
 		<!-- Load the <asdoc> task. We can't do this at the <project> level -->
 		<!-- because targets that run before flexTasks.jar gets built would fail. -->


[09/13] git commit: [flex-sdk] [refs/heads/develop] - Add ability to run all project FlexUnit tests from main build script

Posted by er...@apache.org.
Add ability to run all project FlexUnit tests from main build script

Signed-off-by: Erik de Bruin <er...@ixsoftware.nl>


Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/39272363
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/39272363
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/39272363

Branch: refs/heads/develop
Commit: 392723636b5f8fc1c1cd9ed38d15615b0a84d7c9
Parents: c72d801
Author: Erik de Bruin <er...@ixsoftware.nl>
Authored: Wed Dec 10 12:26:47 2014 +0100
Committer: Erik de Bruin <er...@ixsoftware.nl>
Committed: Wed Dec 10 13:30:05 2014 +0100

----------------------------------------------------------------------
 build.xml                            | 8 ++++++++
 frameworks/build.xml                 | 7 +++++++
 frameworks/projects/apache/build.xml | 2 +-
 3 files changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/39272363/build.xml
----------------------------------------------------------------------
diff --git a/build.xml b/build.xml
index b2e2311..2525e3e 100644
--- a/build.xml
+++ b/build.xml
@@ -1997,4 +1997,12 @@ There are no known issues.
 		<echo>${mymd5}</echo>
 	</target>
 
+  <!--
+      Run FlexUnit tests
+  -->
+
+  <target name="test" description="Run all framework projects' FlexUnit tests">
+      <ant dir="${basedir}/frameworks" target="test"/>
+  </target>
+
 </project>

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/39272363/frameworks/build.xml
----------------------------------------------------------------------
diff --git a/frameworks/build.xml b/frameworks/build.xml
index b43c3b8..c6cbac8 100644
--- a/frameworks/build.xml
+++ b/frameworks/build.xml
@@ -135,6 +135,10 @@
         <antcall target="flatspark"/>
     </target>
 	
+    <target name="test" description="Runs the tests for all projects that have FlexUnit tests">
+        <antcall target="apache-test"/>
+    </target>
+
 	<target name="flex-config" depends="playerglobal-setswfversion" description="Copy the flex/air/airmobile config templates to flex/air/airmobile-config.xml and inject version numbers">
 		<copy file="${basedir}/flex-config-template.xml" tofile="${basedir}/flex-config.xml" overwrite="true">
 			<filterset>
@@ -503,6 +507,9 @@
     <target name="apache" description="Clean build of apache.swc">
         <ant dir="${basedir}/projects/apache"/>
     </target>
+    <target name="apache-test" description="Tests for 'apache' project">
+        <ant dir="${basedir}/projects/apache" target="test"/>
+    </target>
 	
     <target name="experimental" description="Clean build of experimental.swc">
         <ant dir="${basedir}/projects/experimental"/>

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/39272363/frameworks/projects/apache/build.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/apache/build.xml b/frameworks/projects/apache/build.xml
index 07577b9..5e81874 100644
--- a/frameworks/projects/apache/build.xml
+++ b/frameworks/projects/apache/build.xml
@@ -188,7 +188,7 @@
 		</compc>
 	</target>
 	
-  <target name="test" description="Runs FlexUnit tests for 'org.apache.flex' components">
+  <target name="test" description="Runs the FlexUnit tests for the 'apache' project">
     <ant antfile="${FLEX_HOME}/flexunit-tests.xml">
       <property name="project.root" value="${basedir}"/>
     </ant>


[05/13] git commit: [flex-sdk] [refs/heads/develop] - Add Promise to SWC

Posted by er...@apache.org.
Add Promise to SWC

Signed-off-by: Erik de Bruin <er...@ixsoftware.nl>


Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/dd7cd53d
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/dd7cd53d
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/dd7cd53d

Branch: refs/heads/develop
Commit: dd7cd53db90e49f1ce36aa1572eaad425515bdba
Parents: c77b4ea
Author: Erik de Bruin <er...@ixsoftware.nl>
Authored: Tue Dec 9 14:22:28 2014 +0100
Committer: Erik de Bruin <er...@ixsoftware.nl>
Committed: Wed Dec 10 13:30:04 2014 +0100

----------------------------------------------------------------------
 frameworks/projects/apache/manifest.xml | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/dd7cd53d/frameworks/projects/apache/manifest.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/apache/manifest.xml b/frameworks/projects/apache/manifest.xml
index a337a60..15b77f4 100644
--- a/frameworks/projects/apache/manifest.xml
+++ b/frameworks/projects/apache/manifest.xml
@@ -32,4 +32,6 @@
 	<component id="VectorCollection" class="org.apache.flex.collections.VectorCollection"/>
 	<component id="VectorList" class="org.apache.flex.collections.VectorList"/>
 
+	<component id="Promise" class="org.apache.flex.promises.Promise"/>
+
 </componentPackage>


[04/13] git commit: [flex-sdk] [refs/heads/develop] - Add license header

Posted by er...@apache.org.
Add license header

Signed-off-by: Erik de Bruin <er...@ixsoftware.nl>


Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/f872070e
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/f872070e
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/f872070e

Branch: refs/heads/develop
Commit: f872070e54a03fc3591db39f9a3730f581220c84
Parents: dd7cd53
Author: Erik de Bruin <er...@ixsoftware.nl>
Authored: Wed Dec 10 10:33:26 2014 +0100
Committer: Erik de Bruin <er...@ixsoftware.nl>
Committed: Wed Dec 10 13:30:04 2014 +0100

----------------------------------------------------------------------
 .../apache/flex/promises/enums/PromiseState.as   | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f872070e/frameworks/projects/apache/src/org/apache/flex/promises/enums/PromiseState.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/apache/src/org/apache/flex/promises/enums/PromiseState.as b/frameworks/projects/apache/src/org/apache/flex/promises/enums/PromiseState.as
index d44e65e..169180f 100644
--- a/frameworks/projects/apache/src/org/apache/flex/promises/enums/PromiseState.as
+++ b/frameworks/projects/apache/src/org/apache/flex/promises/enums/PromiseState.as
@@ -1,3 +1,22 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
 package org.apache.flex.promises.enums
 {
 


[06/13] git commit: [flex-sdk] [refs/heads/develop] - Updated promises package; all test pass

Posted by er...@apache.org.
Updated promises package; all test pass

Signed-off-by: Erik de Bruin <er...@ixsoftware.nl>


Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/c77b4ea4
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/c77b4ea4
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/c77b4ea4

Branch: refs/heads/develop
Commit: c77b4ea4cd0c6bf250e6e58ad7b11d5416de3087
Parents: 16fb88a
Author: Erik de Bruin <er...@ixsoftware.nl>
Authored: Tue Dec 9 12:14:37 2014 +0100
Committer: Erik de Bruin <er...@ixsoftware.nl>
Committed: Wed Dec 10 13:30:04 2014 +0100

----------------------------------------------------------------------
 .../src/org/apache/flex/promises/Promise.as     | 129 +++++++------------
 .../apache/flex/promises/interfaces/IPromise.as |  30 -----
 .../flex/promises/interfaces/IThenable.as       |   2 +-
 .../tests/promises/cases/PromisesBasicTests.as  |  90 +++++++------
 4 files changed, 100 insertions(+), 151 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/c77b4ea4/frameworks/projects/apache/src/org/apache/flex/promises/Promise.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/apache/src/org/apache/flex/promises/Promise.as b/frameworks/projects/apache/src/org/apache/flex/promises/Promise.as
index bfc62fa..29ecd08 100644
--- a/frameworks/projects/apache/src/org/apache/flex/promises/Promise.as
+++ b/frameworks/projects/apache/src/org/apache/flex/promises/Promise.as
@@ -20,14 +20,11 @@
 package org.apache.flex.promises
 {
 
-import flash.events.TimerEvent;
-import flash.utils.Timer;
-
 import org.apache.flex.promises.enums.PromiseState;
-import org.apache.flex.promises.interfaces.IPromise;
+import org.apache.flex.promises.interfaces.IThenable;
 import org.apache.flex.promises.vo.Handler;
 
-public class Promise implements IPromise
+public class Promise implements IThenable
 {
 
 
@@ -38,11 +35,11 @@ public class Promise implements IPromise
 	//--------------------------------------------------------------------------
 	
 	public function Promise(resolver:Function) {
-		this.handlers_ = new Vector.<Handler>();
+		handlers_ = new Vector.<Handler>();
 		
-		this.state_ = PromiseState.PENDING;
+		state_ = PromiseState.PENDING;
 		
-		this.doResolve_(resolver, this.resolve_, this.reject_);
+		doResolve_(resolver, resolve_, reject_);
 	}
 
 
@@ -68,21 +65,6 @@ public class Promise implements IPromise
 	//--------------------------------------------------------------------------
 	
 	//----------------------------------
-	//    done
-	//----------------------------------
-	
-	public function done(onFulfilled:Function = null, onRejected:Function = null):void
-	{
-		//var self:Promise = this;
-		
-		//var timer:Timer = new Timer(0, 1);
-		//timer.addEventListener(TimerEvent.TIMER, function ():void {
-			this.handle_(new Handler(onFulfilled, onRejected));
-		//});
-		//timer.start();
-	}
-	
-	//----------------------------------
 	//    doResolve_
 	//----------------------------------
 	
@@ -126,79 +108,65 @@ public class Promise implements IPromise
 	}
 	
 	//----------------------------------
-	//    getThen_
-	//----------------------------------
-	
-	private function getThen_(value:*):Function
-	{
-		var type:String = typeof value;
-		
-		if (value && (value === 'object' || value === 'function'))
-		{
-			var then:* = value.then;
-			
-			if (then is Function)
-			{
-				return then;
-			}
-		}
-		
-		return null;
-	}
-	
-	//----------------------------------
 	//    fulfill_
 	//----------------------------------
 	
 	private function fulfill_(result:*):void
 	{
-		this.state_ = PromiseState.FULFILLED;
+		state_ = PromiseState.FULFILLED;
 		
-		this.value_ = result;
+		value_ = result;
 		
-		this.handlers_.forEach(this.handle_);
-		
-		this.handlers_ = null;
+		processHandlers_();
 	}
 	
 	//----------------------------------
 	//    handle_
 	//----------------------------------
 	
-	private function handle_(handler:Object, ...rest):void
+	private function handle_(handler:Handler):void
 	{
-		if (this.state_ === PromiseState.PENDING)
+		if (state_ === PromiseState.PENDING)
 		{
-			trace(this.state_);
-			this.handlers_.push(handler);
+			handlers_.push(handler);
 		}
 		else
 		{
-			if (this.state_ === PromiseState.FULFILLED && handler.onFulfilled != null)
+			if (state_ === PromiseState.FULFILLED && handler.onFulfilled != null)
 			{
-				handler.onFulfilled(this.value_);
+				handler.onFulfilled(value_);
 			}
 			
-			if (this.state_ === PromiseState.REJECTED && handler.onRejected != null)
+			if (state_ === PromiseState.REJECTED && handler.onRejected != null)
 			{
-				handler.onRejected(this.value_);
+				handler.onRejected(value_);
 			}
 		}
 	}
 	
 	//----------------------------------
+	//    processHandlers_
+	//----------------------------------
+	
+	private function processHandlers_():void
+	{
+		for (var i:int = 0, n:int = handlers_.length; i < n; i++)
+		{
+			handle_(handlers_.shift());
+		}
+	}
+	
+	//----------------------------------
 	//    reject_
 	//----------------------------------
 	
 	private function reject_(error:*):void
 	{
-		this.state_ = PromiseState.REJECTED;
-		
-		this.value_ = error;
+		state_ = PromiseState.REJECTED;
 		
-		this.handlers_.forEach(this.handle_);
+		value_ = error;
 		
-		this.handlers_ = null;
+		processHandlers_();
 	}
 	
 	//----------------------------------
@@ -209,19 +177,20 @@ public class Promise implements IPromise
 	{
 		try 
 		{
-			var then:Function = this.getThen_(result);
-			
-			if (then != null) {
-				this.doResolve_(then, this.resolve_, this.reject_);
-				
-				return;
+			if (result && 
+				(typeof(result) === 'object' || typeof(result) === 'function') &&
+				result.then is Function)
+			{
+				doResolve_(result.then, resolve_, reject_);
+			}
+			else 
+			{
+				fulfill_(result);
 			}
-			
-			this.fulfill_(result);
 		}
 		catch (e:Error)
 		{
-			this.reject_(e);
+			reject_(e);
 		}
 	}
 
@@ -230,13 +199,11 @@ public class Promise implements IPromise
 	//----------------------------------
 
 	public function then(onFulfilled:Function = null, 
-						 onRejected:Function = null):IPromise
+						 onRejected:Function = null):IThenable
 	{
-		var self:IPromise = this;
-		
-		var resolver:Function = function (resolve:Function, reject:Function):* {
-			return self.done(function (result:*):* {
-				if (onFulfilled is Function)
+		return new Promise(function (resolve:Function, reject:Function):* {
+			handle_(new Handler(function (result:*):* {
+				if (typeof(onFulfilled) === 'function')
 				{
 					try
 					{
@@ -252,7 +219,7 @@ public class Promise implements IPromise
 					return resolve(result);
 				}
 			}, function (error:*):* {
-				if (onRejected is Function)
+				if (typeof(onRejected) === 'function')
 				{
 					try
 					{
@@ -267,10 +234,8 @@ public class Promise implements IPromise
 				{
 					return reject(error);
 				}
-			});
-		};
-		
-		return new Promise(resolver);
+			}))
+		});
 	}
 
 }

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/c77b4ea4/frameworks/projects/apache/src/org/apache/flex/promises/interfaces/IPromise.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/apache/src/org/apache/flex/promises/interfaces/IPromise.as b/frameworks/projects/apache/src/org/apache/flex/promises/interfaces/IPromise.as
deleted file mode 100644
index 7c70b14..0000000
--- a/frameworks/projects/apache/src/org/apache/flex/promises/interfaces/IPromise.as
+++ /dev/null
@@ -1,30 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-//  Licensed to the Apache Software Foundation (ASF) under one or more
-//  contributor license agreements.  See the NOTICE file distributed with
-//  this work for additional information regarding copyright ownership.
-//  The ASF licenses this file to You under the Apache License, Version 2.0
-//  (the "License"); you may not use this file except in compliance with
-//  the License.  You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-//  Unless required by applicable law or agreed to in writing, software
-//  distributed under the License is distributed on an "AS IS" BASIS,
-//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-//  See the License for the specific language governing permissions and
-//  limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package org.apache.flex.promises.interfaces
-{
-
-public interface IPromise extends IThenable
-{
-
-	function done(onFulfilled:Function = null, onRejected:Function = null):void;
-	
-}
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/c77b4ea4/frameworks/projects/apache/src/org/apache/flex/promises/interfaces/IThenable.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/apache/src/org/apache/flex/promises/interfaces/IThenable.as b/frameworks/projects/apache/src/org/apache/flex/promises/interfaces/IThenable.as
index d154d70..633cdba 100644
--- a/frameworks/projects/apache/src/org/apache/flex/promises/interfaces/IThenable.as
+++ b/frameworks/projects/apache/src/org/apache/flex/promises/interfaces/IThenable.as
@@ -23,7 +23,7 @@ package org.apache.flex.promises.interfaces
 public interface IThenable
 {
 
-	function then(onFulfilled:Function = null, onRejected:Function = null):IPromise;
+	function then(onFulfilled:Function = null, onRejected:Function = null):IThenable;
 	
 }
 

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/c77b4ea4/frameworks/projects/apache/src/tests/promises/cases/PromisesBasicTests.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/apache/src/tests/promises/cases/PromisesBasicTests.as b/frameworks/projects/apache/src/tests/promises/cases/PromisesBasicTests.as
index 494ff86..4d15250 100644
--- a/frameworks/projects/apache/src/tests/promises/cases/PromisesBasicTests.as
+++ b/frameworks/projects/apache/src/tests/promises/cases/PromisesBasicTests.as
@@ -27,7 +27,6 @@ import flash.utils.setTimeout;
 import flexunit.framework.Assert;
 
 import org.apache.flex.promises.Promise;
-import org.apache.flex.promises.interfaces.IPromise;
 import org.apache.flex.promises.interfaces.IThenable;
 import org.flexunit.asserts.assertEquals;
 import org.flexunit.asserts.assertNotNull;
@@ -45,7 +44,7 @@ public class PromisesBasicTests
 	
 	private var expected_:*;
 	
-	private var promise_:IPromise;
+	private var promise_:IThenable;
 	
 	private var got_:*;
 	
@@ -131,16 +130,15 @@ public class PromisesBasicTests
 		assertNotNull(promise_);
 		
 		assertTrue(promise_ is IThenable);
-		assertTrue(promise_ is IPromise);
 		assertTrue(promise_ is Promise);
 	}
 	
 	//----------------------------------
-	//    test_SimpleSyncDone_FulFill
+	//    test_SimpleSyncThen_FulFill
 	//----------------------------------
 	
 	[Test(async)]
-	public function test_SimpleSyncDone_FulFill():void
+	public function test_SimpleSyncThen_FulFill():void
 	{
 		Async.handleEvent(this, timer_, TimerEvent.TIMER_COMPLETE, verifyGot_);
 		
@@ -152,15 +150,15 @@ public class PromisesBasicTests
 		});
 		
 		expected_ = 'Hello world';
-		promise_.done(parseGot_);
+		promise_.then(parseGot_);
 	}
 	
 	//----------------------------------
-	//    test_SimpleSyncDone_Reject
+	//    test_SimpleSyncThen_Reject
 	//----------------------------------
 	
 	[Test(async)]
-	public function test_SimpleSyncDone_Reject():void
+	public function test_SimpleSyncThen_Reject():void
 	{
 		Async.handleEvent(this, timer_, TimerEvent.TIMER_COMPLETE, verifyGot_);
 		
@@ -172,23 +170,24 @@ public class PromisesBasicTests
 		});
 		
 		expected_ = 'Error: reject';
-		promise_.done(null, parseErrorGot_);
+		promise_.then(null, parseErrorGot_);
 	}
 	
 	//----------------------------------
-	//    test_SimpleSyncThen_FulFill
+	//    test_SimpleASyncThen_FulFill
 	//----------------------------------
 	
 	[Test(async)]
-	public function test_SimpleSyncThen_FulFill():void
+	public function test_SimpleASyncThen_FulFill():void
 	{
 		Async.handleEvent(this, timer_, TimerEvent.TIMER_COMPLETE, verifyGot_);
 		
 		timer_.start();
 		
-		promise_ = new Promise(function (fulfill:Function = null, reject:Function = null):*
+		this.promise_ = new Promise(function (fulfill:Function = null, 
+											  reject:Function = null):*
 		{
-			fulfill('Hello world');
+			setTimeout(function ():void { fulfill('Hello world'); }, 10);
 		});
 		
 		expected_ = 'Hello world';
@@ -196,94 +195,109 @@ public class PromisesBasicTests
 	}
 	
 	//----------------------------------
-	//    test_SimpleSyncThen_Reject
+	//    test_SimpleASyncThen_Reject
 	//----------------------------------
 	
 	[Test(async)]
-	public function test_SimpleSyncThen_Reject():void
+	public function test_SimpleASyncThen_Reject():void
 	{
 		Async.handleEvent(this, timer_, TimerEvent.TIMER_COMPLETE, verifyGot_);
 		
 		timer_.start();
 		
-		promise_ = new Promise(function (fulfill:Function = null, reject:Function = null):*
+		this.promise_ = new Promise(function (fulfill:Function = null, 
+											  reject:Function = null):*
 		{
-			reject(new Error('reject'));
+			setTimeout(function ():void { reject(new Error('reject')); }, 10);
 		});
 		
 		expected_ = 'Error: reject';
 		promise_.then(null, parseErrorGot_);
 	}
 	
+	
 	//----------------------------------
-	//    test_SimpleASyncThen_FulFill
+	//    test_MultipleASyncThen_FulFill
 	//----------------------------------
 	
 	[Test(async)]
-	public function test_SimpleASyncThen_FulFill():void
+	public function test_MultipleASyncThen_FulFill():void
 	{
 		Async.handleEvent(this, timer_, TimerEvent.TIMER_COMPLETE, verifyGot_);
 		
 		timer_.start();
 		
-		this.promise_ = new Promise(function (fulfill:Function = null, 
-											  reject:Function = null):*
+		var anotherStep:Function = function (value:*):IThenable
+		{
+			return new Promise(function (fulfill:Function = null, reject:Function = null):*
+			{
+				setTimeout(function ():void { fulfill(value + ' ... again'); }, 10);
+			});
+		}
+		
+		promise_ = new Promise(function (fulfill:Function = null, reject:Function = null):*
 		{
-			setTimeout(function ():void { fulfill('Hello world'); }, 0);
+			setTimeout(function ():void { fulfill('Hello world'); }, 10);
 		});
 		
-		expected_ = 'Hello world';
-		promise_.then(parseGot_);
+		expected_ = 'Hello world ... again';
+		promise_.then(anotherStep).then(parseGot_);
 	}
 	
 	//----------------------------------
-	//    test_SimpleASyncThen_Reject
+	//    test_MultipleASyncThen_RejectLast
 	//----------------------------------
 	
 	[Test(async)]
-	public function test_SimpleASyncThen_Reject():void
+	public function test_MultipleASyncThen_RejectLast():void
 	{
 		Async.handleEvent(this, timer_, TimerEvent.TIMER_COMPLETE, verifyGot_);
 		
 		timer_.start();
 		
-		this.promise_ = new Promise(function (fulfill:Function = null, 
-											  reject:Function = null):*
+		var anotherStep:Function = function (value:*):IThenable
+		{
+			return new Promise(function (fulfill:Function = null, reject:Function = null):*
+			{
+				setTimeout(function ():void { reject(new Error('reject')); }, 10);
+			});
+		}
+		
+		promise_ = new Promise(function (fulfill:Function = null, reject:Function = null):*
 		{
-			setTimeout(function ():void { reject(new Error('reject')); }, 0);
+			setTimeout(function ():void { fulfill('Hello world'); }, 10);
 		});
 		
 		expected_ = 'Error: reject';
-		promise_.then(null, parseErrorGot_);
+		promise_.then(anotherStep).then(null, parseErrorGot_);
 	}
 	
-	
 	//----------------------------------
-	//    test_MultipleASyncThen_FulFill
+	//    test_MultipleASyncThen_RejectFirst
 	//----------------------------------
 	
 	[Test(async)]
-	public function test_MultipleASyncThen_FulFill():void
+	public function test_MultipleASyncThen_Reject():void
 	{
 		Async.handleEvent(this, timer_, TimerEvent.TIMER_COMPLETE, verifyGot_);
 		
 		timer_.start();
 		
-		var anotherStep:Function = function (value:*):IPromise
+		var anotherStep:Function = function (value:*):IThenable
 		{
 			return new Promise(function (fulfill:Function = null, reject:Function = null):*
 			{
-				setTimeout(function ():void { fulfill(value + ' ... again'); }, 0);
+				setTimeout(function ():void { fulfill(value + ' ... again'); }, 10);
 			});
 		}
 		
 		promise_ = new Promise(function (fulfill:Function = null, reject:Function = null):*
 		{
-			setTimeout(function ():void { fulfill('Hello world'); }, 0);
+			setTimeout(function ():void { reject(new Error('reject')); }, 10);
 		});
 		
-		expected_ = 'Hello worlds ... again';
-		promise_.then(anotherStep).then(parseGot_);
+		expected_ = 'Error: reject';
+		promise_.then(anotherStep).then(null, parseErrorGot_);
 	}
 	
 }}
\ No newline at end of file


[03/13] git commit: [flex-sdk] [refs/heads/develop] - Add FlexUnit generated app to .gitignore

Posted by er...@apache.org.
Add FlexUnit generated app to .gitignore

Signed-off-by: Erik de Bruin <er...@ixsoftware.nl>


Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/16fb88a7
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/16fb88a7
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/16fb88a7

Branch: refs/heads/develop
Commit: 16fb88a7a2d0e7573e857de143d97029f47e80ad
Parents: 6dc8070
Author: Erik de Bruin <er...@ixsoftware.nl>
Authored: Tue Dec 9 12:13:35 2014 +0100
Committer: Erik de Bruin <er...@ixsoftware.nl>
Committed: Wed Dec 10 13:30:04 2014 +0100

----------------------------------------------------------------------
 .gitignore | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/16fb88a7/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 1177a2c..72f6ada 100644
--- a/.gitignore
+++ b/.gitignore
@@ -137,3 +137,4 @@ air-sdk-description.xml
 samples/descriptor-sample.xml
 include/FlashRuntimeExtensions.h
 visualcomps
+FlexUnitCompilerApplication.mxml
\ No newline at end of file


[02/13] git commit: [flex-sdk] [refs/heads/develop] - Fix indentation and code layout

Posted by er...@apache.org.
Fix indentation and code layout

Signed-off-by: Erik de Bruin <er...@ixsoftware.nl>


Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/dc7dc470
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/dc7dc470
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/dc7dc470

Branch: refs/heads/develop
Commit: dc7dc4707ea94078c1a4948a5b87c360d705fccd
Parents: f872070
Author: Erik de Bruin <er...@ixsoftware.nl>
Authored: Wed Dec 10 10:33:59 2014 +0100
Committer: Erik de Bruin <er...@ixsoftware.nl>
Committed: Wed Dec 10 13:30:04 2014 +0100

----------------------------------------------------------------------
 .../src/org/apache/flex/promises/Promise.as     | 15 ++++---
 .../flex/promises/interfaces/IThenable.as       |  3 +-
 .../tests/promises/cases/PromisesBasicTests.as  | 42 ++++++++++++++------
 3 files changed, 42 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/dc7dc470/frameworks/projects/apache/src/org/apache/flex/promises/Promise.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/apache/src/org/apache/flex/promises/Promise.as b/frameworks/projects/apache/src/org/apache/flex/promises/Promise.as
index 29ecd08..aacd101 100644
--- a/frameworks/projects/apache/src/org/apache/flex/promises/Promise.as
+++ b/frameworks/projects/apache/src/org/apache/flex/promises/Promise.as
@@ -34,7 +34,8 @@ public class Promise implements IThenable
 	//
 	//--------------------------------------------------------------------------
 	
-	public function Promise(resolver:Function) {
+	public function Promise(resolver:Function) 
+	{
 		handlers_ = new Vector.<Handler>();
 		
 		state_ = PromiseState.PENDING;
@@ -68,7 +69,8 @@ public class Promise implements IThenable
 	//    doResolve_
 	//----------------------------------
 	
-	private function doResolve_(fn:Function, onFulfilled:Function, onRejected:Function):void
+	private function doResolve_(fn:Function, onFulfilled:Function, 
+								onRejected:Function):void
 	{
 		var done:Boolean = false;
 		
@@ -132,12 +134,14 @@ public class Promise implements IThenable
 		}
 		else
 		{
-			if (state_ === PromiseState.FULFILLED && handler.onFulfilled != null)
+			if (state_ === PromiseState.FULFILLED && 
+				handler.onFulfilled != null)
 			{
 				handler.onFulfilled(value_);
 			}
 			
-			if (state_ === PromiseState.REJECTED && handler.onRejected != null)
+			if (state_ === PromiseState.REJECTED && 
+				handler.onRejected != null)
 			{
 				handler.onRejected(value_);
 			}
@@ -178,7 +182,8 @@ public class Promise implements IThenable
 		try 
 		{
 			if (result && 
-				(typeof(result) === 'object' || typeof(result) === 'function') &&
+				(typeof(result) === 'object' || 
+				 typeof(result) === 'function') &&
 				result.then is Function)
 			{
 				doResolve_(result.then, resolve_, reject_);

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/dc7dc470/frameworks/projects/apache/src/org/apache/flex/promises/interfaces/IThenable.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/apache/src/org/apache/flex/promises/interfaces/IThenable.as b/frameworks/projects/apache/src/org/apache/flex/promises/interfaces/IThenable.as
index 633cdba..7106179 100644
--- a/frameworks/projects/apache/src/org/apache/flex/promises/interfaces/IThenable.as
+++ b/frameworks/projects/apache/src/org/apache/flex/promises/interfaces/IThenable.as
@@ -23,7 +23,8 @@ package org.apache.flex.promises.interfaces
 public interface IThenable
 {
 
-	function then(onFulfilled:Function = null, onRejected:Function = null):IThenable;
+	function then(onFulfilled:Function = null,
+				  onRejected:Function = null):IThenable;
 	
 }
 

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/dc7dc470/frameworks/projects/apache/src/tests/promises/cases/PromisesBasicTests.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/apache/src/tests/promises/cases/PromisesBasicTests.as b/frameworks/projects/apache/src/tests/promises/cases/PromisesBasicTests.as
index 4d15250..978795e 100644
--- a/frameworks/projects/apache/src/tests/promises/cases/PromisesBasicTests.as
+++ b/frameworks/projects/apache/src/tests/promises/cases/PromisesBasicTests.as
@@ -229,15 +229,21 @@ public class PromisesBasicTests
 		
 		var anotherStep:Function = function (value:*):IThenable
 		{
-			return new Promise(function (fulfill:Function = null, reject:Function = null):*
+			return new Promise(function (fulfill:Function = null, 
+										 reject:Function = null):*
 			{
-				setTimeout(function ():void { fulfill(value + ' ... again'); }, 10);
+				setTimeout(function ():void { 
+					fulfill(value + ' ... again'); 
+				}, 10);
 			});
 		}
 		
-		promise_ = new Promise(function (fulfill:Function = null, reject:Function = null):*
+		promise_ = new Promise(function (fulfill:Function = null, 
+										 reject:Function = null):*
 		{
-			setTimeout(function ():void { fulfill('Hello world'); }, 10);
+			setTimeout(function ():void { 
+				fulfill('Hello world'); 
+			}, 10);
 		});
 		
 		expected_ = 'Hello world ... again';
@@ -257,15 +263,21 @@ public class PromisesBasicTests
 		
 		var anotherStep:Function = function (value:*):IThenable
 		{
-			return new Promise(function (fulfill:Function = null, reject:Function = null):*
+			return new Promise(function (fulfill:Function = null, 
+										 reject:Function = null):*
 			{
-				setTimeout(function ():void { reject(new Error('reject')); }, 10);
+				setTimeout(function ():void { 
+					reject(new Error('reject')); 
+				}, 10);
 			});
 		}
 		
-		promise_ = new Promise(function (fulfill:Function = null, reject:Function = null):*
+		promise_ = new Promise(function (fulfill:Function = null, 
+										 reject:Function = null):*
 		{
-			setTimeout(function ():void { fulfill('Hello world'); }, 10);
+			setTimeout(function ():void { 
+				fulfill('Hello world'); 
+			}, 10);
 		});
 		
 		expected_ = 'Error: reject';
@@ -285,15 +297,21 @@ public class PromisesBasicTests
 		
 		var anotherStep:Function = function (value:*):IThenable
 		{
-			return new Promise(function (fulfill:Function = null, reject:Function = null):*
+			return new Promise(function (fulfill:Function = null, 
+										 reject:Function = null):*
 			{
-				setTimeout(function ():void { fulfill(value + ' ... again'); }, 10);
+				setTimeout(function ():void { 
+					fulfill(value + ' ... again'); 
+				}, 10);
 			});
 		}
 		
-		promise_ = new Promise(function (fulfill:Function = null, reject:Function = null):*
+		promise_ = new Promise(function (fulfill:Function = null, 
+										 reject:Function = null):*
 		{
-			setTimeout(function ():void { reject(new Error('reject')); }, 10);
+			setTimeout(function ():void { 
+				reject(new Error('reject')); 
+			}, 10);
 		});
 		
 		expected_ = 'Error: reject';