OLD | NEW |
1 dart_library.library('unittest', null, /* Imports */[ | 1 dart_library.library('unittest', null, /* Imports */[ |
2 'dart_sdk', | 2 'dart_sdk', |
3 'stack_trace' | 3 'stack_trace' |
4 ], function load__unittest(exports, dart_sdk, stack_trace) { | 4 ], function load__unittest(exports, dart_sdk, stack_trace) { |
5 'use strict'; | 5 'use strict'; |
6 const core = dart_sdk.core; | 6 const core = dart_sdk.core; |
7 const collection = dart_sdk.collection; | 7 const collection = dart_sdk.collection; |
8 const async = dart_sdk.async; | 8 const async = dart_sdk.async; |
9 const _interceptors = dart_sdk._interceptors; | 9 const _interceptors = dart_sdk._interceptors; |
10 const isolate = dart_sdk.isolate; | 10 const isolate = dart_sdk.isolate; |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 } | 410 } |
411 }; | 411 }; |
412 dart.fn(unittest._setTestEnabledState, int__Tovoid()); | 412 dart.fn(unittest._setTestEnabledState, int__Tovoid()); |
413 unittest._requireNotRunning = function() { | 413 unittest._requireNotRunning = function() { |
414 if (src__test_environment.environment.currentTestCaseIndex == -1) return; | 414 if (src__test_environment.environment.currentTestCaseIndex == -1) return; |
415 dart.throw(new core.StateError('Not allowed when tests are running.')); | 415 dart.throw(new core.StateError('Not allowed when tests are running.')); |
416 }; | 416 }; |
417 dart.fn(unittest._requireNotRunning, VoidTovoid$()); | 417 dart.fn(unittest._requireNotRunning, VoidTovoid$()); |
418 let const$; | 418 let const$; |
419 unittest.withTestEnvironment = function(callback) { | 419 unittest.withTestEnvironment = function(callback) { |
420 return async.runZoned(dart.dynamic)(callback, {zoneValues: dart.map([const$
|| (const$ = dart.const(core.Symbol.new('unittest.environment'))), new src__test
_environment.TestEnvironment()])}); | 420 return async.runZoned(dart.dynamic)(callback, {zoneValues: dart.map([const$
|| (const$ = dart.const(core.Symbol.new('unittest.environment'))), new src__test
_environment.TestEnvironment()], core.Symbol, src__test_environment.TestEnvironm
ent)}); |
421 }; | 421 }; |
422 dart.fn(unittest.withTestEnvironment, FnTodynamic()); | 422 dart.fn(unittest.withTestEnvironment, FnTodynamic()); |
423 let const$0; | 423 let const$0; |
424 src__configuration.Configuration = class Configuration extends core.Object { | 424 src__configuration.Configuration = class Configuration extends core.Object { |
425 static new() { | 425 static new() { |
426 return new src__simple_configuration.SimpleConfiguration(); | 426 return new src__simple_configuration.SimpleConfiguration(); |
427 } | 427 } |
428 blank() { | 428 blank() { |
429 this.autoStart = true; | 429 this.autoStart = true; |
430 this.timeout = const$0 || (const$0 = dart.const(new core.Duration({minutes
: 2}))); | 430 this.timeout = const$0 || (const$0 = dart.const(new core.Duration({minutes
: 2}))); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 this[_featureName] = featureName; | 533 this[_featureName] = featureName; |
534 this[_matcher] = src__matcher__util.wrapMatcher(matcher); | 534 this[_matcher] = src__matcher__util.wrapMatcher(matcher); |
535 super.new(); | 535 super.new(); |
536 } | 536 } |
537 featureValueOf(actual) { | 537 featureValueOf(actual) { |
538 return actual; | 538 return actual; |
539 } | 539 } |
540 matches(item, matchState) { | 540 matches(item, matchState) { |
541 let f = this.featureValueOf(item); | 541 let f = this.featureValueOf(item); |
542 if (dart.test(this[_matcher].matches(f, matchState))) return true; | 542 if (dart.test(this[_matcher].matches(f, matchState))) return true; |
543 src__matcher__util.addStateInfo(matchState, dart.map({feature: f})); | 543 src__matcher__util.addStateInfo(matchState, dart.map({feature: f}, core.St
ring, dart.dynamic)); |
544 return false; | 544 return false; |
545 } | 545 } |
546 describe(description) { | 546 describe(description) { |
547 return description.add(this[_featureDescription]).add(' ').addDescriptionO
f(this[_matcher]); | 547 return description.add(this[_featureDescription]).add(' ').addDescriptionO
f(this[_matcher]); |
548 } | 548 } |
549 describeMismatch(item, mismatchDescription, matchState, verbose) { | 549 describeMismatch(item, mismatchDescription, matchState, verbose) { |
550 mismatchDescription.add('has ').add(this[_featureName]).add(' with value '
).addDescriptionOf(matchState[dartx.get]('feature')); | 550 mismatchDescription.add('has ').add(this[_featureName]).add(' with value '
).addDescriptionOf(matchState[dartx.get]('feature')); |
551 let innerDescription = new src__matcher__description.StringDescription(); | 551 let innerDescription = new src__matcher__description.StringDescription(); |
552 this[_matcher].describeMismatch(matchState[dartx.get]('feature'), innerDes
cription, core.Map._check(matchState[dartx.get]('state')), verbose); | 552 this[_matcher].describeMismatch(matchState[dartx.get]('feature'), innerDes
cription, core.Map._check(matchState[dartx.get]('state')), verbose); |
553 if (dart.notNull(innerDescription.length) > 0) { | 553 if (dart.notNull(innerDescription.length) > 0) { |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 return true; | 754 return true; |
755 } | 755 } |
756 try { | 756 try { |
757 dart.dcall(item); | 757 dart.dcall(item); |
758 return false; | 758 return false; |
759 } catch (e) { | 759 } catch (e) { |
760 let s = dart.stackTrace(e); | 760 let s = dart.stackTrace(e); |
761 if (this[_matcher$] == null || dart.test(this[_matcher$].matches(e, matc
hState))) { | 761 if (this[_matcher$] == null || dart.test(this[_matcher$].matches(e, matc
hState))) { |
762 return true; | 762 return true; |
763 } else { | 763 } else { |
764 src__matcher__util.addStateInfo(matchState, dart.map({exception: e, st
ack: s})); | 764 src__matcher__util.addStateInfo(matchState, dart.map({exception: e, st
ack: s}, core.String, dart.dynamic)); |
765 return false; | 765 return false; |
766 } | 766 } |
767 } | 767 } |
768 | 768 |
769 } | 769 } |
770 describe(description) { | 770 describe(description) { |
771 if (this[_matcher$] == null) { | 771 if (this[_matcher$] == null) { |
772 return description.add("throws"); | 772 return description.add("throws"); |
773 } else { | 773 } else { |
774 return description.add('throws ').addDescriptionOf(this[_matcher$]); | 774 return description.add('throws ').addDescriptionOf(this[_matcher$]); |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
936 src__matcher__core_matchers._ReturnsNormally = class _ReturnsNormally extends
src__matcher__interfaces.Matcher { | 936 src__matcher__core_matchers._ReturnsNormally = class _ReturnsNormally extends
src__matcher__interfaces.Matcher { |
937 new() { | 937 new() { |
938 super.new(); | 938 super.new(); |
939 } | 939 } |
940 matches(f, matchState) { | 940 matches(f, matchState) { |
941 try { | 941 try { |
942 dart.dcall(f); | 942 dart.dcall(f); |
943 return true; | 943 return true; |
944 } catch (e) { | 944 } catch (e) { |
945 let s = dart.stackTrace(e); | 945 let s = dart.stackTrace(e); |
946 src__matcher__util.addStateInfo(matchState, dart.map({exception: e, stac
k: s})); | 946 src__matcher__util.addStateInfo(matchState, dart.map({exception: e, stac
k: s}, core.String, dart.dynamic)); |
947 return false; | 947 return false; |
948 } | 948 } |
949 | 949 |
950 } | 950 } |
951 describe(description) { | 951 describe(description) { |
952 return description.add("return normally"); | 952 return description.add("return normally"); |
953 } | 953 } |
954 describeMismatch(item, mismatchDescription, matchState, verbose) { | 954 describeMismatch(item, mismatchDescription, matchState, verbose) { |
955 mismatchDescription.add('threw ').addDescriptionOf(matchState[dartx.get]('
exception')); | 955 mismatchDescription.add('threw ').addDescriptionOf(matchState[dartx.get]('
exception')); |
956 if (dart.test(verbose)) { | 956 if (dart.test(verbose)) { |
(...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1901 let reason = null; | 1901 let reason = null; |
1902 if (dart.test(dart.dsend(dart.dload(rp[dartx.get](0), 'length'), '>', 0)))
{ | 1902 if (dart.test(dart.dsend(dart.dload(rp[dartx.get](0), 'length'), '>', 0)))
{ |
1903 if (dart.test(dart.dsend(dart.dload(rp[dartx.get](1), 'length'), '>', 0)
)) { | 1903 if (dart.test(dart.dsend(dart.dload(rp[dartx.get](1), 'length'), '>', 0)
)) { |
1904 reason = dart.str`${rp[dartx.get](0)} at location ${rp[dartx.get](1)}`
; | 1904 reason = dart.str`${rp[dartx.get](0)} at location ${rp[dartx.get](1)}`
; |
1905 } else { | 1905 } else { |
1906 reason = rp[dartx.get](0); | 1906 reason = rp[dartx.get](0); |
1907 } | 1907 } |
1908 } else { | 1908 } else { |
1909 reason = ''; | 1909 reason = ''; |
1910 } | 1910 } |
1911 src__matcher__util.addStateInfo(matchState, dart.map({reason: reason})); | 1911 src__matcher__util.addStateInfo(matchState, dart.map({reason: reason}, cor
e.String, dart.dynamic)); |
1912 return core.String._check(reason); | 1912 return core.String._check(reason); |
1913 } | 1913 } |
1914 matches(item, matchState) { | 1914 matches(item, matchState) { |
1915 return this[_match](this[_expected], item, matchState) == null; | 1915 return this[_match](this[_expected], item, matchState) == null; |
1916 } | 1916 } |
1917 describe(description) { | 1917 describe(description) { |
1918 return description.addDescriptionOf(this[_expected]); | 1918 return description.addDescriptionOf(this[_expected]); |
1919 } | 1919 } |
1920 describeMismatch(item, mismatchDescription, matchState, verbose) { | 1920 describeMismatch(item, mismatchDescription, matchState, verbose) { |
1921 let reason = matchState[dartx.get]('reason'); | 1921 let reason = matchState[dartx.get]('reason'); |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2209 return "?"; | 2209 return "?"; |
2210 } | 2210 } |
2211 | 2211 |
2212 }; | 2212 }; |
2213 dart.fn(src__matcher__pretty_print._typeName, dynamicToString()); | 2213 dart.fn(src__matcher__pretty_print._typeName, dynamicToString()); |
2214 src__matcher__pretty_print._escapeString = function(source) { | 2214 src__matcher__pretty_print._escapeString = function(source) { |
2215 return src__matcher__util.escape(source)[dartx.replaceAll]("'", "\\'"); | 2215 return src__matcher__util.escape(source)[dartx.replaceAll]("'", "\\'"); |
2216 }; | 2216 }; |
2217 dart.fn(src__matcher__pretty_print._escapeString, StringToString()); | 2217 dart.fn(src__matcher__pretty_print._escapeString, StringToString()); |
2218 src__matcher__util._Predicate = dart.typedef('_Predicate', () => dart.function
Type(core.bool, [dart.dynamic])); | 2218 src__matcher__util._Predicate = dart.typedef('_Predicate', () => dart.function
Type(core.bool, [dart.dynamic])); |
2219 src__matcher__util._escapeMap = dart.const(dart.map({'\n': '\\n', '\r': '\\r',
'\f': '\\f', '\b': '\\b', '\t': '\\t', '\v': '\\v', '': '\\x7F'})); | 2219 src__matcher__util._escapeMap = dart.const(dart.map({'\n': '\\n', '\r': '\\r',
'\f': '\\f', '\b': '\\b', '\t': '\\t', '\v': '\\v', '': '\\x7F'}, core.String,
core.String)); |
2220 dart.defineLazy(src__matcher__util, { | 2220 dart.defineLazy(src__matcher__util, { |
2221 get _escapeRegExp() { | 2221 get _escapeRegExp() { |
2222 return core.RegExp.new(dart.str`[\\x00-\\x07\\x0E-\\x1F${src__matcher__uti
l._escapeMap[dartx.keys][dartx.map](core.String)(src__matcher__util._getHexLiter
al)[dartx.join]()}]`); | 2222 return core.RegExp.new(dart.str`[\\x00-\\x07\\x0E-\\x1F${src__matcher__uti
l._escapeMap[dartx.keys][dartx.map](core.String)(src__matcher__util._getHexLiter
al)[dartx.join]()}]`); |
2223 } | 2223 } |
2224 }); | 2224 }); |
2225 src__matcher__util._getHexLiteral = function(input) { | 2225 src__matcher__util._getHexLiteral = function(input) { |
2226 let rune = input[dartx.runes].single; | 2226 let rune = input[dartx.runes].single; |
2227 return '\\x' + dart.notNull(rune[dartx.toRadixString](16)[dartx.toUpperCase]
()[dartx.padLeft](2, '0')); | 2227 return '\\x' + dart.notNull(rune[dartx.toRadixString](16)[dartx.toUpperCase]
()[dartx.padLeft](2, '0')); |
2228 }; | 2228 }; |
2229 dart.fn(src__matcher__util._getHexLiteral, StringToString()); | 2229 dart.fn(src__matcher__util._getHexLiteral, StringToString()); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2265 this[_matcher$1] = matcher; | 2265 this[_matcher$1] = matcher; |
2266 super.new(); | 2266 super.new(); |
2267 } | 2267 } |
2268 matches(item, matchState) { | 2268 matches(item, matchState) { |
2269 if (!core.Iterable.is(item)) { | 2269 if (!core.Iterable.is(item)) { |
2270 return false; | 2270 return false; |
2271 } | 2271 } |
2272 let i = 0; | 2272 let i = 0; |
2273 for (let element of core.Iterable._check(item)) { | 2273 for (let element of core.Iterable._check(item)) { |
2274 if (!dart.test(this[_matcher$1].matches(element, matchState))) { | 2274 if (!dart.test(this[_matcher$1].matches(element, matchState))) { |
2275 src__matcher__util.addStateInfo(matchState, dart.map({index: i, elemen
t: element})); | 2275 src__matcher__util.addStateInfo(matchState, dart.map({index: i, elemen
t: element}, core.String, dart.dynamic)); |
2276 return false; | 2276 return false; |
2277 } | 2277 } |
2278 ++i; | 2278 ++i; |
2279 } | 2279 } |
2280 return true; | 2280 return true; |
2281 } | 2281 } |
2282 describe(description) { | 2282 describe(description) { |
2283 return description.add('every element(').addDescriptionOf(this[_matcher$1]
).add(')'); | 2283 return description.add('every element(').addDescriptionOf(this[_matcher$1]
).add(')'); |
2284 } | 2284 } |
2285 describeMismatch(item, mismatchDescription, matchState, verbose) { | 2285 describeMismatch(item, mismatchDescription, matchState, verbose) { |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2433 super.new(); | 2433 super.new(); |
2434 } | 2434 } |
2435 matches(item, matchState) { | 2435 matches(item, matchState) { |
2436 if (!core.Iterable.is(item)) return false; | 2436 if (!core.Iterable.is(item)) return false; |
2437 if (!dart.equals(dart.dload(item, 'length'), this[_expected$][dartx.length
])) return false; | 2437 if (!dart.equals(dart.dload(item, 'length'), this[_expected$][dartx.length
])) return false; |
2438 let iterator = dart.dload(item, 'iterator'); | 2438 let iterator = dart.dload(item, 'iterator'); |
2439 let i = 0; | 2439 let i = 0; |
2440 for (let e of this[_expected$]) { | 2440 for (let e of this[_expected$]) { |
2441 dart.dsend(iterator, 'moveNext'); | 2441 dart.dsend(iterator, 'moveNext'); |
2442 if (!dart.test(dart.dcall(this[_comparator], e, dart.dload(iterator, 'cu
rrent')))) { | 2442 if (!dart.test(dart.dcall(this[_comparator], e, dart.dload(iterator, 'cu
rrent')))) { |
2443 src__matcher__util.addStateInfo(matchState, dart.map({index: i, expect
ed: e, actual: dart.dload(iterator, 'current')})); | 2443 src__matcher__util.addStateInfo(matchState, dart.map({index: i, expect
ed: e, actual: dart.dload(iterator, 'current')}, core.String, dart.dynamic)); |
2444 return false; | 2444 return false; |
2445 } | 2445 } |
2446 i++; | 2446 i++; |
2447 } | 2447 } |
2448 return true; | 2448 return true; |
2449 } | 2449 } |
2450 describe(description) { | 2450 describe(description) { |
2451 return description.add(dart.str`pairwise ${this[_description$]} `).addDesc
riptionOf(this[_expected$]); | 2451 return description.add(dart.str`pairwise ${this[_description$]} `).addDesc
riptionOf(this[_expected$]); |
2452 } | 2452 } |
2453 describeMismatch(item, mismatchDescription, matchState, verbose) { | 2453 describeMismatch(item, mismatchDescription, matchState, verbose) { |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2624 }); | 2624 }); |
2625 const _matchers = Symbol('_matchers'); | 2625 const _matchers = Symbol('_matchers'); |
2626 src__matcher__operator_matchers._AllOf = class _AllOf extends src__matcher__in
terfaces.Matcher { | 2626 src__matcher__operator_matchers._AllOf = class _AllOf extends src__matcher__in
terfaces.Matcher { |
2627 new(matchers) { | 2627 new(matchers) { |
2628 this[_matchers] = matchers; | 2628 this[_matchers] = matchers; |
2629 super.new(); | 2629 super.new(); |
2630 } | 2630 } |
2631 matches(item, matchState) { | 2631 matches(item, matchState) { |
2632 for (let matcher of this[_matchers]) { | 2632 for (let matcher of this[_matchers]) { |
2633 if (!dart.test(matcher.matches(item, matchState))) { | 2633 if (!dart.test(matcher.matches(item, matchState))) { |
2634 src__matcher__util.addStateInfo(matchState, dart.map({matcher: matcher
})); | 2634 src__matcher__util.addStateInfo(matchState, dart.map({matcher: matcher
}, core.String, src__matcher__interfaces.Matcher)); |
2635 return false; | 2635 return false; |
2636 } | 2636 } |
2637 } | 2637 } |
2638 return true; | 2638 return true; |
2639 } | 2639 } |
2640 describeMismatch(item, mismatchDescription, matchState, verbose) { | 2640 describeMismatch(item, mismatchDescription, matchState, verbose) { |
2641 let matcher = matchState[dartx.get]('matcher'); | 2641 let matcher = matchState[dartx.get]('matcher'); |
2642 dart.dsend(matcher, 'describeMismatch', item, mismatchDescription, matchSt
ate[dartx.get]('state'), verbose); | 2642 dart.dsend(matcher, 'describeMismatch', item, mismatchDescription, matchSt
ate[dartx.get]('state'), verbose); |
2643 return mismatchDescription; | 2643 return mismatchDescription; |
2644 } | 2644 } |
(...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3731 exports.src__internal_test_case = src__internal_test_case; | 3731 exports.src__internal_test_case = src__internal_test_case; |
3732 exports.src__test_environment = src__test_environment; | 3732 exports.src__test_environment = src__test_environment; |
3733 exports.src__group_context = src__group_context; | 3733 exports.src__group_context = src__group_context; |
3734 exports.src__utils = src__utils; | 3734 exports.src__utils = src__utils; |
3735 exports.src__test_case = src__test_case; | 3735 exports.src__test_case = src__test_case; |
3736 exports.src__expected_function = src__expected_function; | 3736 exports.src__expected_function = src__expected_function; |
3737 exports.html_config = html_config; | 3737 exports.html_config = html_config; |
3738 exports.html_individual_config = html_individual_config; | 3738 exports.html_individual_config = html_individual_config; |
3739 exports.html_enhanced_config = html_enhanced_config; | 3739 exports.html_enhanced_config = html_enhanced_config; |
3740 }); | 3740 }); |
OLD | NEW |