チェンジセット 518

差分発生行の前後
無視リスト:
コミット日時:
2008/05/27 11:07:50 (6 ヶ月前)
コミッタ:
yossy
ログメッセージ:

Thread(soumen): 書き忘れてた例外のテスト追加

ファイル:

凡例:

変更無し
追加
削除
更新
コピー
移動
  • as3/Thread/branches/soumen/tests/org/libspark/thread/ExceptionTest.as

    r517 r518  
    240240                 
    241241                /** 
     242                 * 親スレッドが待機中に子スレッドで発生した例外を親に伝播することができるか。 
     243                 */ 
     244                test function childExceptionWhileWaiting():void 
     245                { 
     246                        Static.log = ''; 
     247                         
     248                        var t:TesterThread = new TesterThread(new ChildExceptionWhileWaitingTestThread()); 
     249                         
     250                        t.addEventListener(Event.COMPLETE, async(function(e:Event):void 
     251                        { 
     252                                assertEquals('p.run c.run c.run2 p.error c.finalize p.finalize ', Static.log); 
     253                        }, 1000)); 
     254                         
     255                        t.start(); 
     256                } 
     257                 
     258                /** 
    242259                 * 子スレッドで発生した例外を子スレッドの例外ハンドラで処理することができるか。 
    243260                 */ 
     
    689706} 
    690707 
     708class ChildExceptionWhileWaitingTestThread extends Thread 
     709{ 
     710        override protected function run():void 
     711        { 
     712                Static.log += 'p.run '; 
     713                 
     714                new ChildExceptionWhileWaitingTestChildThread().start(); 
     715                 
     716                error(Error, runError); 
     717                wait(); 
     718        } 
     719         
     720        private function runError(e:Error, t:Thread):void 
     721        { 
     722                Static.log += 'p.error '; 
     723        } 
     724         
     725        override protected function finalize():void 
     726        { 
     727                Static.log += 'p.finalize '; 
     728        } 
     729} 
     730 
     731class ChildExceptionWhileWaitingTestChildThread extends Thread 
     732{ 
     733        public var ex:Error = new Error(); 
     734         
     735        override protected function run():void 
     736        { 
     737                Static.log += 'c.run '; 
     738                 
     739                next(run2); 
     740        } 
     741         
     742        private function run2():void 
     743        { 
     744                Static.log += 'c.run2 '; 
     745                 
     746                throw ex; 
     747        } 
     748         
     749        override protected function finalize():void 
     750        { 
     751                Static.log += 'c.finalize '; 
     752        } 
     753} 
     754 
    691755class ChildExceptionHandlerTestThread extends Thread 
    692756{