OLD | NEW |
(Empty) | |
| 1 dart_library.library('language/async_rethrow_test', null, /* Imports */[ |
| 2 'dart_sdk', |
| 3 'expect' |
| 4 ], function load__async_rethrow_test(exports, dart_sdk, expect) { |
| 5 'use strict'; |
| 6 const core = dart_sdk.core; |
| 7 const async = dart_sdk.async; |
| 8 const dart = dart_sdk.dart; |
| 9 const dartx = dart_sdk.dartx; |
| 10 const expect$ = expect.expect; |
| 11 const async_rethrow_test = Object.create(null); |
| 12 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT
ype(dart.dynamic, [])))(); |
| 13 let dynamicTodynamic = () => (dynamicTodynamic = dart.constFn(dart.definiteFun
ctionType(dart.dynamic, [dart.dynamic])))(); |
| 14 async_rethrow_test.exceptionString = "exceptionalString"; |
| 15 async_rethrow_test.throwString = function() { |
| 16 return dart.async(function*() { |
| 17 try { |
| 18 dart.throw(async_rethrow_test.exceptionString); |
| 19 } catch (e) { |
| 20 yield 1; |
| 21 dart.throw(e); |
| 22 } |
| 23 |
| 24 }, dart.dynamic); |
| 25 }; |
| 26 dart.fn(async_rethrow_test.throwString, VoidTodynamic()); |
| 27 async_rethrow_test.rethrowString = function() { |
| 28 return dart.async(function*() { |
| 29 try { |
| 30 dart.throw(async_rethrow_test.exceptionString); |
| 31 } catch (e) { |
| 32 yield 1; |
| 33 throw e; |
| 34 } |
| 35 |
| 36 }, dart.dynamic); |
| 37 }; |
| 38 dart.fn(async_rethrow_test.rethrowString, VoidTodynamic()); |
| 39 async_rethrow_test.testThrow = function() { |
| 40 let f = async.Future._check(async_rethrow_test.throwString()); |
| 41 f.then(dart.dynamic)(dart.fn(v => { |
| 42 expect$.Expect.fail("Exception not thrown"); |
| 43 }, dynamicTodynamic()), {onError: dart.fn(e => { |
| 44 expect$.Expect.equals(async_rethrow_test.exceptionString, e); |
| 45 }, dynamicTodynamic())}); |
| 46 }; |
| 47 dart.fn(async_rethrow_test.testThrow, VoidTodynamic()); |
| 48 async_rethrow_test.testRethrow = function() { |
| 49 let f = async.Future._check(async_rethrow_test.rethrowString()); |
| 50 f.then(dart.dynamic)(dart.fn(v => { |
| 51 expect$.Expect.fail("Exception not thrown"); |
| 52 }, dynamicTodynamic()), {onError: dart.fn(e => { |
| 53 expect$.Expect.equals(async_rethrow_test.exceptionString, e); |
| 54 }, dynamicTodynamic())}); |
| 55 }; |
| 56 dart.fn(async_rethrow_test.testRethrow, VoidTodynamic()); |
| 57 async_rethrow_test.main = function() { |
| 58 async_rethrow_test.testThrow(); |
| 59 async_rethrow_test.testRethrow(); |
| 60 }; |
| 61 dart.fn(async_rethrow_test.main, VoidTodynamic()); |
| 62 // Exports: |
| 63 exports.async_rethrow_test = async_rethrow_test; |
| 64 }); |
OLD | NEW |