| OLD | NEW |
| 1 dart_library.library('unittest', null, /* Imports */[ | 1 dart_library.library('unittest', null, /* Imports */[ |
| 2 'dart_sdk', | 2 'dart_sdk', |
| 3 'matcher' | 3 'matcher' |
| 4 ], function(exports, dart_sdk, matcher) { | 4 ], function(exports, dart_sdk, matcher) { |
| 5 'use strict'; | 5 'use strict'; |
| 6 const core = dart_sdk.core; | 6 const core = dart_sdk.core; |
| 7 const async = dart_sdk.async; | 7 const async = dart_sdk.async; |
| 8 const js = dart_sdk.js; | 8 const js = dart_sdk.js; |
| 9 const dart = dart_sdk.dart; | 9 const dart = dart_sdk.dart; |
| 10 const dartx = dart_sdk.dartx; | 10 const dartx = dart_sdk.dartx; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 unittest.Throws = class Throws extends src__interfaces.Matcher { | 32 unittest.Throws = class Throws extends src__interfaces.Matcher { |
| 33 Throws(matcher) { | 33 Throws(matcher) { |
| 34 if (matcher === void 0) matcher = null; | 34 if (matcher === void 0) matcher = null; |
| 35 this[_matcher] = matcher; | 35 this[_matcher] = matcher; |
| 36 super.Matcher(); | 36 super.Matcher(); |
| 37 } | 37 } |
| 38 matches(item, matchState) { | 38 matches(item, matchState) { |
| 39 if (!dart.is(item, core.Function) && !dart.is(item, async.Future)) return
false; | 39 if (!dart.is(item, core.Function) && !dart.is(item, async.Future)) return
false; |
| 40 if (dart.is(item, async.Future)) { | 40 if (dart.is(item, async.Future)) { |
| 41 let done = dart.dcall(unittest._wrapAsync, dart.fn(fn => dart.dcall(fn))
); | 41 let done = dart.dcall(unittest._wrapAsync, dart.fn(fn => dart.dcall(fn))
); |
| 42 item.then(dart.fn(value => { | 42 item.then(dart.dynamic)(dart.fn(value => { |
| 43 dart.dcall(done, dart.fn(() => { | 43 dart.dcall(done, dart.fn(() => { |
| 44 unittest.fail(`Expected future to fail, but succeeded with '${value}
'.`); | 44 unittest.fail(`Expected future to fail, but succeeded with '${value}
'.`); |
| 45 })); | 45 })); |
| 46 }), {onError: dart.fn((error, trace) => { | 46 }), {onError: dart.fn((error, trace) => { |
| 47 dart.dcall(done, dart.fn(() => { | 47 dart.dcall(done, dart.fn(() => { |
| 48 if (this[_matcher] == null) return; | 48 if (this[_matcher] == null) return; |
| 49 let reason = null; | 49 let reason = null; |
| 50 if (trace != null) { | 50 if (trace != null) { |
| 51 let stackTrace = dart.toString(trace); | 51 let stackTrace = dart.toString(trace); |
| 52 stackTrace = ` ${stackTrace[dartx.replaceAll]("\n", "\n ")}`; | 52 stackTrace = ` ${stackTrace[dartx.replaceAll]("\n", "\n ")}`; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 dart.fn(unittest.group, dart.void, [core.String, dart.functionType(dart.void,
[])]); | 110 dart.fn(unittest.group, dart.void, [core.String, dart.functionType(dart.void,
[])]); |
| 111 unittest.test = function(name, body, opts) { | 111 unittest.test = function(name, body, opts) { |
| 112 let skip = opts && 'skip' in opts ? opts.skip : null; | 112 let skip = opts && 'skip' in opts ? opts.skip : null; |
| 113 if (skip != null) { | 113 if (skip != null) { |
| 114 core.print(`SKIP ${name}: ${skip}`); | 114 core.print(`SKIP ${name}: ${skip}`); |
| 115 return; | 115 return; |
| 116 } | 116 } |
| 117 let result = dart.as(js.context.callMethod('test', dart.list([name, dart.fn(
done => { | 117 let result = dart.as(js.context.callMethod('test', dart.list([name, dart.fn(
done => { |
| 118 function _finishTest(f) { | 118 function _finishTest(f) { |
| 119 if (dart.is(f, async.Future)) { | 119 if (dart.is(f, async.Future)) { |
| 120 f.then(_finishTest); | 120 f.then(dart.dynamic)(_finishTest); |
| 121 } else { | 121 } else { |
| 122 done.apply([]); | 122 done.apply([]); |
| 123 } | 123 } |
| 124 } | 124 } |
| 125 dart.fn(_finishTest); | 125 dart.fn(_finishTest); |
| 126 _finishTest(body()); | 126 _finishTest(body()); |
| 127 }, dart.dynamic, [js.JsFunction])], core.Object)), js.JsObject); | 127 }, dart.dynamic, [js.JsFunction])], core.Object)), js.JsObject); |
| 128 result.set('async', 1); | 128 result.set('async', 1); |
| 129 }; | 129 }; |
| 130 dart.fn(unittest.test, dart.void, [core.String, dart.functionType(dart.dynamic
, [])], {skip: core.String}); | 130 dart.fn(unittest.test, dart.void, [core.String, dart.functionType(dart.dynamic
, [])], {skip: core.String}); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 unittest.greaterThan = src__numeric_matchers.greaterThan; | 253 unittest.greaterThan = src__numeric_matchers.greaterThan; |
| 254 unittest.isNonNegative = src__numeric_matchers.isNonNegative; | 254 unittest.isNonNegative = src__numeric_matchers.isNonNegative; |
| 255 unittest.isNull = src__core_matchers.isNull; | 255 unittest.isNull = src__core_matchers.isNull; |
| 256 unittest.isMap = src__core_matchers.isMap; | 256 unittest.isMap = src__core_matchers.isMap; |
| 257 unittest.stringContainsInOrder = src__string_matchers.stringContainsInOrder; | 257 unittest.stringContainsInOrder = src__string_matchers.stringContainsInOrder; |
| 258 unittest.closeTo = src__numeric_matchers.closeTo; | 258 unittest.closeTo = src__numeric_matchers.closeTo; |
| 259 unittest.Description = src__interfaces.Description; | 259 unittest.Description = src__interfaces.Description; |
| 260 // Exports: | 260 // Exports: |
| 261 exports.unittest = unittest; | 261 exports.unittest = unittest; |
| 262 }); | 262 }); |
| OLD | NEW |