OLD | NEW |
(Empty) | |
| 1 dart_library.library('language/assertion_test', null, /* Imports */[ |
| 2 'dart_sdk', |
| 3 'expect' |
| 4 ], function load__assertion_test(exports, dart_sdk, expect) { |
| 5 'use strict'; |
| 6 const core = dart_sdk.core; |
| 7 const dart = dart_sdk.dart; |
| 8 const dartx = dart_sdk.dartx; |
| 9 const expect$ = expect.expect; |
| 10 const assertion_test = Object.create(null); |
| 11 let VoidTobool = () => (VoidTobool = dart.constFn(dart.definiteFunctionType(co
re.bool, [])))(); |
| 12 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT
ype(dart.dynamic, [])))(); |
| 13 assertion_test.AssertionTest = class AssertionTest extends core.Object { |
| 14 static testTrue() { |
| 15 let i = 0; |
| 16 try { |
| 17 dart.assert(true); |
| 18 } catch (error) { |
| 19 if (core.AssertionError.is(error)) { |
| 20 i = 1; |
| 21 } else |
| 22 throw error; |
| 23 } |
| 24 |
| 25 return i; |
| 26 } |
| 27 static testFalse() { |
| 28 let i = 0; |
| 29 try { |
| 30 dart.assert(false); |
| 31 } catch (error) { |
| 32 if (core.AssertionError.is(error)) { |
| 33 i = 1; |
| 34 } else |
| 35 throw error; |
| 36 } |
| 37 |
| 38 return i; |
| 39 } |
| 40 static unknown(a) { |
| 41 return dart.test(a) ? true : false; |
| 42 } |
| 43 static testUnknown() { |
| 44 let x = assertion_test.AssertionTest.unknown(false); |
| 45 let i = 0; |
| 46 try { |
| 47 dart.assert(x); |
| 48 } catch (error) { |
| 49 if (core.AssertionError.is(error)) { |
| 50 i = 1; |
| 51 } else |
| 52 throw error; |
| 53 } |
| 54 |
| 55 return i; |
| 56 } |
| 57 static testClosure() { |
| 58 let i = 0; |
| 59 try { |
| 60 dart.assert(dart.fn(() => false, VoidTobool())); |
| 61 } catch (error) { |
| 62 if (core.AssertionError.is(error)) { |
| 63 i = 1; |
| 64 } else |
| 65 throw error; |
| 66 } |
| 67 |
| 68 return i; |
| 69 } |
| 70 static testClosure2() { |
| 71 let i = 0; |
| 72 try { |
| 73 let x = dart.fn(() => false, VoidTobool()); |
| 74 dart.assert(x); |
| 75 } catch (error) { |
| 76 if (core.AssertionError.is(error)) { |
| 77 i = 1; |
| 78 } else |
| 79 throw error; |
| 80 } |
| 81 |
| 82 return i; |
| 83 } |
| 84 static testMain() { |
| 85 expect$.Expect.equals(0, assertion_test.AssertionTest.testTrue()); |
| 86 expect$.Expect.equals(1, assertion_test.AssertionTest.testFalse()); |
| 87 expect$.Expect.equals(1, assertion_test.AssertionTest.testClosure()); |
| 88 expect$.Expect.equals(1, assertion_test.AssertionTest.testClosure2()); |
| 89 } |
| 90 }; |
| 91 dart.setSignature(assertion_test.AssertionTest, { |
| 92 statics: () => ({ |
| 93 testTrue: dart.definiteFunctionType(dart.dynamic, []), |
| 94 testFalse: dart.definiteFunctionType(dart.dynamic, []), |
| 95 unknown: dart.definiteFunctionType(dart.dynamic, [dart.dynamic]), |
| 96 testUnknown: dart.definiteFunctionType(dart.dynamic, []), |
| 97 testClosure: dart.definiteFunctionType(dart.dynamic, []), |
| 98 testClosure2: dart.definiteFunctionType(dart.dynamic, []), |
| 99 testMain: dart.definiteFunctionType(dart.dynamic, []) |
| 100 }), |
| 101 names: ['testTrue', 'testFalse', 'unknown', 'testUnknown', 'testClosure', 't
estClosure2', 'testMain'] |
| 102 }); |
| 103 assertion_test.main = function() { |
| 104 assertion_test.AssertionTest.testMain(); |
| 105 }; |
| 106 dart.fn(assertion_test.main, VoidTodynamic()); |
| 107 // Exports: |
| 108 exports.assertion_test = assertion_test; |
| 109 }); |
OLD | NEW |