| OLD | NEW |
| 1 dart_library.library('matcher', null, /* Imports */[ | 1 dart_library.library('matcher', null, /* Imports */[ |
| 2 'dart_sdk' | 2 'dart_sdk' |
| 3 ], function load__matcher(exports, dart_sdk) { | 3 ], function load__matcher(exports, dart_sdk) { |
| 4 'use strict'; | 4 'use strict'; |
| 5 const core = dart_sdk.core; | 5 const core = dart_sdk.core; |
| 6 const mirrors = dart_sdk.mirrors; | 6 const mirrors = dart_sdk.mirrors; |
| 7 const _interceptors = dart_sdk._interceptors; | 7 const _interceptors = dart_sdk._interceptors; |
| 8 const dart = dart_sdk.dart; | 8 const dart = dart_sdk.dart; |
| 9 const dartx = dart_sdk.dartx; | 9 const dartx = dart_sdk.dartx; |
| 10 const matcher = Object.create(null); | |
| 11 const mirror_matchers = Object.create(null); | 10 const mirror_matchers = Object.create(null); |
| 12 const src__core_matchers = Object.create(null); | 11 const src__pretty_print = Object.create(null); |
| 13 const src__description = Object.create(null); | |
| 14 const src__error_matchers = Object.create(null); | |
| 15 const src__interfaces = Object.create(null); | |
| 16 const src__iterable_matchers = Object.create(null); | 12 const src__iterable_matchers = Object.create(null); |
| 17 const src__map_matchers = Object.create(null); | 13 const src__map_matchers = Object.create(null); |
| 14 const src__error_matchers = Object.create(null); |
| 15 const src__description = Object.create(null); |
| 16 const src__util = Object.create(null); |
| 17 const src__operator_matchers = Object.create(null); |
| 18 const src__interfaces = Object.create(null); |
| 19 const src__string_matchers = Object.create(null); |
| 20 const src__core_matchers = Object.create(null); |
| 18 const src__numeric_matchers = Object.create(null); | 21 const src__numeric_matchers = Object.create(null); |
| 19 const src__operator_matchers = Object.create(null); | 22 const matcher = Object.create(null); |
| 20 const src__pretty_print = Object.create(null); | |
| 21 const src__string_matchers = Object.create(null); | |
| 22 const src__util = Object.create(null); | |
| 23 let dynamicTobool = () => (dynamicTobool = dart.constFn(dart.functionType(core
.bool, [dart.dynamic])))(); | |
| 24 let isInstanceOf = () => (isInstanceOf = dart.constFn(src__core_matchers.isIns
tanceOf$()))(); | |
| 25 let dynamicAnddynamicTobool = () => (dynamicAnddynamicTobool = dart.constFn(da
rt.functionType(core.bool, [dart.dynamic, dart.dynamic])))(); | |
| 26 let ListOfString = () => (ListOfString = dart.constFn(core.List$(core.String))
)(); | |
| 27 let JSArrayOfString = () => (JSArrayOfString = dart.constFn(_interceptors.JSAr
ray$(core.String)))(); | 23 let JSArrayOfString = () => (JSArrayOfString = dart.constFn(_interceptors.JSAr
ray$(core.String)))(); |
| 28 let ListOfbool = () => (ListOfbool = dart.constFn(core.List$(core.bool)))(); | 24 let ListOfbool = () => (ListOfbool = dart.constFn(core.List$(core.bool)))(); |
| 25 let dynamicAnddynamicTobool = () => (dynamicAnddynamicTobool = dart.constFn(da
rt.functionType(core.bool, [dart.dynamic, dart.dynamic])))(); |
| 29 let ListOfMatcher = () => (ListOfMatcher = dart.constFn(core.List$(src__interf
aces.Matcher)))(); | 26 let ListOfMatcher = () => (ListOfMatcher = dart.constFn(core.List$(src__interf
aces.Matcher)))(); |
| 30 let dynamicToMatcher = () => (dynamicToMatcher = dart.constFn(dart.definiteFun
ctionType(src__interfaces.Matcher, [dart.dynamic])))(); | 27 let ListOfString = () => (ListOfString = dart.constFn(core.List$(core.String))
)(); |
| 31 let dynamic__ToMatcher = () => (dynamic__ToMatcher = dart.constFn(dart.definit
eFunctionType(src__interfaces.Matcher, [dart.dynamic], [core.int])))(); | 28 let isInstanceOf = () => (isInstanceOf = dart.constFn(src__core_matchers.isIns
tanceOf$()))(); |
| 32 let Fn__ToMatcher = () => (Fn__ToMatcher = dart.constFn(dart.definiteFunctionT
ype(src__interfaces.Matcher, [dynamicTobool()], [core.String])))(); | 29 let dynamicTobool = () => (dynamicTobool = dart.constFn(dart.functionType(core
.bool, [dart.dynamic])))(); |
| 33 let IterableAndFnAndStringToMatcher = () => (IterableAndFnAndStringToMatcher =
dart.constFn(dart.definiteFunctionType(src__interfaces.Matcher, [core.Iterable,
dynamicAnddynamicTobool(), core.String])))(); | 30 let String__ToMatcher = () => (String__ToMatcher = dart.constFn(dart.definiteF
unctionType(src__interfaces.Matcher, [core.String], [dart.dynamic])))(); |
| 34 let IterableToMatcher = () => (IterableToMatcher = dart.constFn(dart.definiteF
unctionType(src__interfaces.Matcher, [core.Iterable])))(); | 31 let dynamicToString = () => (dynamicToString = dart.constFn(dart.definiteFunct
ionType(core.String, [dart.dynamic])))(); |
| 35 let dynamicAnddynamicToMatcher = () => (dynamicAnddynamicToMatcher = dart.cons
tFn(dart.definiteFunctionType(src__interfaces.Matcher, [dart.dynamic, dart.dynam
ic])))(); | |
| 36 let numAndnumToMatcher = () => (numAndnumToMatcher = dart.constFn(dart.definit
eFunctionType(src__interfaces.Matcher, [core.num, core.num])))(); | |
| 37 let dynamic__ToMatcher$ = () => (dynamic__ToMatcher$ = dart.constFn(dart.defin
iteFunctionType(src__interfaces.Matcher, [dart.dynamic], [dart.dynamic, dart.dyn
amic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic])))(); | |
| 38 let StringToMatcher = () => (StringToMatcher = dart.constFn(dart.definiteFunct
ionType(src__interfaces.Matcher, [core.String])))(); | |
| 39 let StringToString = () => (StringToString = dart.constFn(dart.definiteFunctio
nType(core.String, [core.String])))(); | 32 let StringToString = () => (StringToString = dart.constFn(dart.definiteFunctio
nType(core.String, [core.String])))(); |
| 40 let ListOfStringToMatcher = () => (ListOfStringToMatcher = dart.constFn(dart.d
efiniteFunctionType(src__interfaces.Matcher, [ListOfString()])))(); | |
| 41 let MapAndMapTovoid = () => (MapAndMapTovoid = dart.constFn(dart.definiteFunct
ionType(dart.void, [core.Map, core.Map])))(); | |
| 42 let MatchToString = () => (MatchToString = dart.constFn(dart.definiteFunctionT
ype(core.String, [core.Match])))(); | |
| 43 let String__ToMatcher = () => (String__ToMatcher = dart.constFn(dart.definiteF
unctionType(src__interfaces.Matcher, [core.String], [dart.dynamic])))(); | |
| 44 let dynamicTobool$ = () => (dynamicTobool$ = dart.constFn(dart.definiteFunctio
nType(core.bool, [dart.dynamic])))(); | |
| 45 let dynamicAnddynamicAnddynamic__ToListOfMatcher = () => (dynamicAnddynamicAnd
dynamic__ToListOfMatcher = dart.constFn(dart.definiteFunctionType(ListOfMatcher(
), [dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.d
ynamic, dart.dynamic])))(); | |
| 46 let dynamicToString = () => (dynamicToString = dart.constFn(dart.definiteFunct
ionType(core.String, [dart.dynamic])))(); | |
| 47 let dynamicAndintAndSet__ToString = () => (dynamicAndintAndSet__ToString = dar
t.constFn(dart.definiteFunctionType(core.String, [dart.dynamic, core.int, core.S
et, core.bool])))(); | 33 let dynamicAndintAndSet__ToString = () => (dynamicAndintAndSet__ToString = dar
t.constFn(dart.definiteFunctionType(core.String, [dart.dynamic, core.int, core.S
et, core.bool])))(); |
| 48 let dynamic__ToString = () => (dynamic__ToString = dart.constFn(dart.definiteF
unctionType(core.String, [dart.dynamic], {maxLineLength: core.int, maxItems: cor
e.int})))(); | 34 let dynamic__ToString = () => (dynamic__ToString = dart.constFn(dart.definiteF
unctionType(core.String, [dart.dynamic], {maxLineLength: core.int, maxItems: cor
e.int})))(); |
| 49 let intToString = () => (intToString = dart.constFn(dart.definiteFunctionType(
core.String, [core.int])))(); | 35 let intToString = () => (intToString = dart.constFn(dart.definiteFunctionType(
core.String, [core.int])))(); |
| 36 let dynamicToMatcher = () => (dynamicToMatcher = dart.constFn(dart.definiteFun
ctionType(src__interfaces.Matcher, [dart.dynamic])))(); |
| 37 let dynamicTobool$ = () => (dynamicTobool$ = dart.constFn(dart.definiteFunctio
nType(core.bool, [dart.dynamic])))(); |
| 38 let IterableToMatcher = () => (IterableToMatcher = dart.constFn(dart.definiteF
unctionType(src__interfaces.Matcher, [core.Iterable])))(); |
| 39 let IterableAndFnAndStringToMatcher = () => (IterableAndFnAndStringToMatcher =
dart.constFn(dart.definiteFunctionType(src__interfaces.Matcher, [core.Iterable,
dynamicAnddynamicTobool(), core.String])))(); |
| 40 let dynamicAnddynamicToMatcher = () => (dynamicAnddynamicToMatcher = dart.cons
tFn(dart.definiteFunctionType(src__interfaces.Matcher, [dart.dynamic, dart.dynam
ic])))(); |
| 41 let MapAndMapTovoid = () => (MapAndMapTovoid = dart.constFn(dart.definiteFunct
ionType(dart.void, [core.Map, core.Map])))(); |
| 42 let MatchToString = () => (MatchToString = dart.constFn(dart.definiteFunctionT
ype(core.String, [core.Match])))(); |
| 43 let dynamic__ToMatcher = () => (dynamic__ToMatcher = dart.constFn(dart.definit
eFunctionType(src__interfaces.Matcher, [dart.dynamic], [dart.dynamic, dart.dynam
ic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic])))(); |
| 44 let dynamicAnddynamicAnddynamic__ToListOfMatcher = () => (dynamicAnddynamicAnd
dynamic__ToListOfMatcher = dart.constFn(dart.definiteFunctionType(ListOfMatcher(
), [dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.d
ynamic, dart.dynamic])))(); |
| 45 let StringToMatcher = () => (StringToMatcher = dart.constFn(dart.definiteFunct
ionType(src__interfaces.Matcher, [core.String])))(); |
| 46 let ListOfStringToMatcher = () => (ListOfStringToMatcher = dart.constFn(dart.d
efiniteFunctionType(src__interfaces.Matcher, [ListOfString()])))(); |
| 50 let StringTobool = () => (StringTobool = dart.constFn(dart.definiteFunctionTyp
e(core.bool, [core.String])))(); | 47 let StringTobool = () => (StringTobool = dart.constFn(dart.definiteFunctionTyp
e(core.bool, [core.String])))(); |
| 48 let dynamic__ToMatcher$ = () => (dynamic__ToMatcher$ = dart.constFn(dart.defin
iteFunctionType(src__interfaces.Matcher, [dart.dynamic], [core.int])))(); |
| 49 let Fn__ToMatcher = () => (Fn__ToMatcher = dart.constFn(dart.definiteFunctionT
ype(src__interfaces.Matcher, [dynamicTobool()], [core.String])))(); |
| 50 let numAndnumToMatcher = () => (numAndnumToMatcher = dart.constFn(dart.definit
eFunctionType(src__interfaces.Matcher, [core.num, core.num])))(); |
| 51 mirror_matchers.hasProperty = function(name, matcher) { |
| 52 if (matcher === void 0) matcher = null; |
| 53 return new mirror_matchers._HasProperty(name, matcher == null ? null : src__
util.wrapMatcher(matcher)); |
| 54 }; |
| 55 dart.lazyFn(mirror_matchers.hasProperty, () => String__ToMatcher()); |
| 56 const _name = Symbol('_name'); |
| 57 const _matcher = Symbol('_matcher'); |
| 51 src__interfaces.Matcher = class Matcher extends core.Object { | 58 src__interfaces.Matcher = class Matcher extends core.Object { |
| 52 new() { | 59 new() { |
| 53 } | 60 } |
| 54 describeMismatch(item, mismatchDescription, matchState, verbose) { | 61 describeMismatch(item, mismatchDescription, matchState, verbose) { |
| 55 return mismatchDescription; | 62 return mismatchDescription; |
| 56 } | 63 } |
| 57 }; | 64 }; |
| 58 dart.setSignature(src__interfaces.Matcher, { | 65 dart.setSignature(src__interfaces.Matcher, { |
| 59 constructors: () => ({new: dart.definiteFunctionType(src__interfaces.Matcher
, [])}), | 66 constructors: () => ({new: dart.definiteFunctionType(src__interfaces.Matcher
, [])}), |
| 60 methods: () => ({describeMismatch: dart.definiteFunctionType(src__interfaces
.Description, [dart.dynamic, src__interfaces.Description, core.Map, core.bool])}
) | 67 methods: () => ({describeMismatch: dart.definiteFunctionType(src__interfaces
.Description, [dart.dynamic, src__interfaces.Description, core.Map, core.bool])}
) |
| 61 }); | 68 }); |
| 62 src__core_matchers._IsTrue = class _IsTrue extends src__interfaces.Matcher { | 69 mirror_matchers._HasProperty = class _HasProperty extends src__interfaces.Matc
her { |
| 70 new(name, matcher) { |
| 71 if (matcher === void 0) matcher = null; |
| 72 this[_name] = name; |
| 73 this[_matcher] = matcher; |
| 74 super.new(); |
| 75 } |
| 76 matches(item, matchState) { |
| 77 let mirror = mirrors.reflect(item); |
| 78 let classMirror = mirror.type; |
| 79 let symbol = core.Symbol.new(this[_name]); |
| 80 let candidate = classMirror.declarations[dartx.get](symbol); |
| 81 if (candidate == null) { |
| 82 src__util.addStateInfo(matchState, dart.map({reason: dart.str`has no pro
perty named "${this[_name]}"`})); |
| 83 return false; |
| 84 } |
| 85 let isInstanceField = mirrors.VariableMirror.is(candidate) && !dart.test(c
andidate.isStatic); |
| 86 let isInstanceGetter = mirrors.MethodMirror.is(candidate) && dart.test(can
didate.isGetter) && !dart.test(candidate.isStatic); |
| 87 if (!(isInstanceField || isInstanceGetter)) { |
| 88 src__util.addStateInfo(matchState, dart.map({reason: dart.str`has a memb
er named "${this[_name]}", but it is not an instance property`})); |
| 89 return false; |
| 90 } |
| 91 if (this[_matcher] == null) return true; |
| 92 let result = mirror.getField(symbol); |
| 93 let resultMatches = this[_matcher].matches(result.reflectee, matchState); |
| 94 if (!dart.test(resultMatches)) { |
| 95 src__util.addStateInfo(matchState, dart.map({value: result.reflectee})); |
| 96 } |
| 97 return resultMatches; |
| 98 } |
| 99 describe(description) { |
| 100 description.add(dart.str`has property "${this[_name]}"`); |
| 101 if (this[_matcher] != null) { |
| 102 description.add(' which matches ').addDescriptionOf(this[_matcher]); |
| 103 } |
| 104 return description; |
| 105 } |
| 106 describeMismatch(item, mismatchDescription, matchState, verbose) { |
| 107 let reason = matchState == null ? null : matchState[dartx.get]('reason'); |
| 108 if (reason != null) { |
| 109 mismatchDescription.add(core.String._check(reason)); |
| 110 } else { |
| 111 mismatchDescription.add(dart.str`has property "${this[_name]}" with valu
e `).addDescriptionOf(matchState[dartx.get]('value')); |
| 112 let innerDescription = new src__description.StringDescription(); |
| 113 this[_matcher].describeMismatch(matchState[dartx.get]('value'), innerDes
cription, core.Map._check(matchState[dartx.get]('state')), verbose); |
| 114 if (dart.notNull(innerDescription.length) > 0) { |
| 115 mismatchDescription.add(' which ').add(innerDescription.toString()); |
| 116 } |
| 117 } |
| 118 return mismatchDescription; |
| 119 } |
| 120 }; |
| 121 dart.setSignature(mirror_matchers._HasProperty, { |
| 122 constructors: () => ({new: dart.definiteFunctionType(mirror_matchers._HasPro
perty, [core.String], [src__interfaces.Matcher])}), |
| 123 methods: () => ({ |
| 124 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), |
| 125 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) |
| 126 }) |
| 127 }); |
| 128 src__pretty_print.prettyPrint = function(object, opts) { |
| 129 let maxLineLength = opts && 'maxLineLength' in opts ? opts.maxLineLength : n
ull; |
| 130 let maxItems = opts && 'maxItems' in opts ? opts.maxItems : null; |
| 131 function _prettyPrint(object, indent, seen, top) { |
| 132 if (src__interfaces.Matcher.is(object)) { |
| 133 let description = new src__description.StringDescription(); |
| 134 object.describe(description); |
| 135 return dart.str`<${description}>`; |
| 136 } |
| 137 if (dart.test(seen.contains(object))) return "(recursive)"; |
| 138 seen = seen.union(core.Set.from([object])); |
| 139 function pp(child) { |
| 140 return _prettyPrint(child, dart.notNull(indent) + 2, seen, false); |
| 141 } |
| 142 dart.fn(pp, dynamicToString()); |
| 143 if (core.Iterable.is(object)) { |
| 144 let type = core.List.is(object) ? "" : dart.notNull(src__pretty_print._t
ypeName(object)) + ":"; |
| 145 let strings = object[dartx.map](core.String)(pp)[dartx.toList](); |
| 146 if (maxItems != null && dart.notNull(strings[dartx.length]) > dart.notNu
ll(maxItems)) { |
| 147 strings[dartx.replaceRange](dart.notNull(maxItems) - 1, strings[dartx.
length], JSArrayOfString().of(['...'])); |
| 148 } |
| 149 let singleLine = dart.str`${type}[${strings[dartx.join](', ')}]`; |
| 150 if ((maxLineLength == null || dart.notNull(singleLine[dartx.length]) + d
art.notNull(indent) <= dart.notNull(maxLineLength)) && !dart.test(singleLine[dar
tx.contains]("\n"))) { |
| 151 return singleLine; |
| 152 } |
| 153 return dart.str`${type}[\n` + dart.notNull(strings[dartx.map](core.Strin
g)(dart.fn(string => dart.notNull(src__pretty_print._indent(dart.notNull(indent)
+ 2)) + dart.notNull(string), StringToString()))[dartx.join](",\n")) + "\n" + d
art.notNull(src__pretty_print._indent(indent)) + "]"; |
| 154 } else if (core.Map.is(object)) { |
| 155 let strings = object[dartx.keys][dartx.map](core.String)(dart.fn(key =>
dart.str`${pp(key)}: ${pp(object[dartx.get](key))}`, dynamicToString()))[dartx.t
oList](); |
| 156 if (maxItems != null && dart.notNull(strings[dartx.length]) > dart.notNu
ll(maxItems)) { |
| 157 strings[dartx.replaceRange](dart.notNull(maxItems) - 1, strings[dartx.
length], JSArrayOfString().of(['...'])); |
| 158 } |
| 159 let singleLine = dart.str`{${strings[dartx.join](", ")}}`; |
| 160 if ((maxLineLength == null || dart.notNull(singleLine[dartx.length]) + d
art.notNull(indent) <= dart.notNull(maxLineLength)) && !dart.test(singleLine[dar
tx.contains]("\n"))) { |
| 161 return singleLine; |
| 162 } |
| 163 return "{\n" + dart.notNull(strings[dartx.map](core.String)(dart.fn(stri
ng => dart.notNull(src__pretty_print._indent(dart.notNull(indent) + 2)) + dart.n
otNull(string), StringToString()))[dartx.join](",\n")) + "\n" + dart.notNull(src
__pretty_print._indent(indent)) + "}"; |
| 164 } else if (typeof object == 'string') { |
| 165 let lines = object[dartx.split]("\n"); |
| 166 return "'" + dart.notNull(lines[dartx.map](core.String)(src__pretty_prin
t._escapeString)[dartx.join](dart.str`\\n'\n${src__pretty_print._indent(dart.not
Null(indent) + 2)}'`)) + "'"; |
| 167 } else { |
| 168 let value = dart.toString(object)[dartx.replaceAll]("\n", dart.notNull(s
rc__pretty_print._indent(indent)) + "\n"); |
| 169 let defaultToString = value[dartx.startsWith]("Instance of "); |
| 170 if (dart.test(top)) value = dart.str`<${value}>`; |
| 171 if (typeof object == 'number' || typeof object == 'boolean' || core.Func
tion.is(object) || object == null || dart.test(defaultToString)) { |
| 172 return value; |
| 173 } else { |
| 174 return dart.str`${src__pretty_print._typeName(object)}:${value}`; |
| 175 } |
| 176 } |
| 177 } |
| 178 dart.fn(_prettyPrint, dynamicAndintAndSet__ToString()); |
| 179 return _prettyPrint(object, 0, core.Set.new(), true); |
| 180 }; |
| 181 dart.fn(src__pretty_print.prettyPrint, dynamic__ToString()); |
| 182 src__pretty_print._indent = function(length) { |
| 183 return core.List.filled(length, ' ')[dartx.join](''); |
| 184 }; |
| 185 dart.fn(src__pretty_print._indent, intToString()); |
| 186 src__pretty_print._typeName = function(x) { |
| 187 try { |
| 188 if (x == null) return "null"; |
| 189 let type = dart.toString(dart.runtimeType(x)); |
| 190 return dart.test(type[dartx.startsWith]("_")) ? "?" : type; |
| 191 } catch (e) { |
| 192 return "?"; |
| 193 } |
| 194 |
| 195 }; |
| 196 dart.fn(src__pretty_print._typeName, dynamicToString()); |
| 197 src__pretty_print._escapeString = function(source) { |
| 198 return src__util.escape(source)[dartx.replaceAll]("'", "\\'"); |
| 199 }; |
| 200 dart.fn(src__pretty_print._escapeString, StringToString()); |
| 201 src__iterable_matchers.everyElement = function(matcher) { |
| 202 return new src__iterable_matchers._EveryElement(src__util.wrapMatcher(matche
r)); |
| 203 }; |
| 204 dart.fn(src__iterable_matchers.everyElement, dynamicToMatcher()); |
| 205 const _matcher$ = Symbol('_matcher'); |
| 206 src__iterable_matchers._IterableMatcher = class _IterableMatcher extends src__
interfaces.Matcher { |
| 63 new() { | 207 new() { |
| 64 super.new(); | 208 super.new(); |
| 65 } | 209 } |
| 66 matches(item, matchState) { | 210 describeMismatch(item, mismatchDescription, matchState, verbose) { |
| 67 return dart.equals(item, true); | 211 if (!core.Iterable.is(item)) { |
| 68 } | 212 return mismatchDescription.addDescriptionOf(item).add(' not an Iterable'
); |
| 69 describe(description) { | 213 } else { |
| 70 return description.add('true'); | 214 return super.describeMismatch(item, mismatchDescription, matchState, ver
bose); |
| 71 } | 215 } |
| 72 }; | 216 } |
| 73 dart.setSignature(src__core_matchers._IsTrue, { | 217 }; |
| 74 constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._IsT
rue, [])}), | 218 dart.setSignature(src__iterable_matchers._IterableMatcher, { |
| 75 methods: () => ({ | 219 constructors: () => ({new: dart.definiteFunctionType(src__iterable_matchers.
_IterableMatcher, [])}) |
| 76 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), | 220 }); |
| 77 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) | 221 src__iterable_matchers._EveryElement = class _EveryElement extends src__iterab
le_matchers._IterableMatcher { |
| 78 }) | 222 new(matcher) { |
| 79 }); | 223 this[_matcher$] = matcher; |
| 80 src__core_matchers.isTrue = dart.const(new src__core_matchers._IsTrue()); | 224 super.new(); |
| 81 matcher.isTrue = src__core_matchers.isTrue; | 225 } |
| 82 src__core_matchers._IsFalse = class _IsFalse extends src__interfaces.Matcher { | 226 matches(item, matchState) { |
| 83 new() { | 227 if (!core.Iterable.is(item)) { |
| 84 super.new(); | 228 return false; |
| 85 } | 229 } |
| 86 matches(item, matchState) { | 230 let i = 0; |
| 87 return dart.equals(item, false); | 231 for (let element of core.Iterable._check(item)) { |
| 88 } | 232 if (!dart.test(this[_matcher$].matches(element, matchState))) { |
| 89 describe(description) { | 233 src__util.addStateInfo(matchState, dart.map({index: i, element: elemen
t})); |
| 90 return description.add('false'); | 234 return false; |
| 91 } | 235 } |
| 92 }; | 236 ++i; |
| 93 dart.setSignature(src__core_matchers._IsFalse, { | 237 } |
| 94 constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._IsF
alse, [])}), | 238 return true; |
| 95 methods: () => ({ | 239 } |
| 96 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), | 240 describe(description) { |
| 97 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) | 241 return description.add('every element(').addDescriptionOf(this[_matcher$])
.add(')'); |
| 98 }) | 242 } |
| 99 }); | 243 describeMismatch(item, mismatchDescription, matchState, verbose) { |
| 100 src__core_matchers.isFalse = dart.const(new src__core_matchers._IsFalse()); | 244 if (matchState[dartx.get]('index') != null) { |
| 101 matcher.isFalse = src__core_matchers.isFalse; | 245 let index = matchState[dartx.get]('index'); |
| 102 src__core_matchers._Empty = class _Empty extends src__interfaces.Matcher { | 246 let element = matchState[dartx.get]('element'); |
| 103 new() { | 247 mismatchDescription.add('has value ').addDescriptionOf(element).add(' wh
ich '); |
| 104 super.new(); | 248 let subDescription = new src__description.StringDescription(); |
| 105 } | 249 this[_matcher$].describeMismatch(element, subDescription, core.Map._chec
k(matchState[dartx.get]('state')), verbose); |
| 106 matches(item, matchState) { | 250 if (dart.notNull(subDescription.length) > 0) { |
| 107 return core.bool._check(dart.dload(item, 'isEmpty')); | 251 mismatchDescription.add(subDescription.toString()); |
| 108 } | 252 } else { |
| 109 describe(description) { | 253 mismatchDescription.add("doesn't match "); |
| 110 return description.add('empty'); | 254 this[_matcher$].describe(mismatchDescription); |
| 111 } | 255 } |
| 112 }; | 256 mismatchDescription.add(dart.str` at index ${index}`); |
| 113 dart.setSignature(src__core_matchers._Empty, { | 257 return mismatchDescription; |
| 114 constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._Emp
ty, [])}), | 258 } |
| 115 methods: () => ({ | 259 return super.describeMismatch(item, mismatchDescription, matchState, verbo
se); |
| 116 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), | 260 } |
| 117 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) | 261 }; |
| 118 }) | 262 dart.setSignature(src__iterable_matchers._EveryElement, { |
| 119 }); | 263 constructors: () => ({new: dart.definiteFunctionType(src__iterable_matchers.
_EveryElement, [src__interfaces.Matcher])}), |
| 120 src__core_matchers.isEmpty = dart.const(new src__core_matchers._Empty()); | 264 methods: () => ({ |
| 121 matcher.isEmpty = src__core_matchers.isEmpty; | 265 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), |
| 122 src__core_matchers.same = function(expected) { | 266 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) |
| 123 return new src__core_matchers._IsSameAs(expected); | 267 }) |
| 124 }; | 268 }); |
| 125 dart.fn(src__core_matchers.same, dynamicToMatcher()); | 269 src__iterable_matchers.anyElement = function(matcher) { |
| 126 matcher.same = src__core_matchers.same; | 270 return new src__iterable_matchers._AnyElement(src__util.wrapMatcher(matcher)
); |
| 127 src__core_matchers.equals = function(expected, limit) { | 271 }; |
| 128 if (limit === void 0) limit = 100; | 272 dart.fn(src__iterable_matchers.anyElement, dynamicToMatcher()); |
| 129 return typeof expected == 'string' ? new src__core_matchers._StringEqualsMat
cher(expected) : new src__core_matchers._DeepMatcher(expected, limit); | 273 src__iterable_matchers._AnyElement = class _AnyElement extends src__iterable_m
atchers._IterableMatcher { |
| 130 }; | 274 new(matcher) { |
| 131 dart.fn(src__core_matchers.equals, dynamic__ToMatcher()); | 275 this[_matcher$] = matcher; |
| 132 matcher.equals = src__core_matchers.equals; | 276 super.new(); |
| 133 const _featureDescription = Symbol('_featureDescription'); | 277 } |
| 134 const _featureName = Symbol('_featureName'); | 278 matches(item, matchState) { |
| 135 const _matcher = Symbol('_matcher'); | 279 return core.bool._check(dart.dsend(item, 'any', dart.fn(e => this[_matcher
$].matches(e, matchState), dynamicTobool$()))); |
| 136 src__core_matchers.CustomMatcher = class CustomMatcher extends src__interfaces
.Matcher { | 280 } |
| 137 new(featureDescription, featureName, matcher) { | 281 describe(description) { |
| 138 this[_featureDescription] = featureDescription; | 282 return description.add('some element ').addDescriptionOf(this[_matcher$]); |
| 139 this[_featureName] = featureName; | 283 } |
| 140 this[_matcher] = src__util.wrapMatcher(matcher); | 284 }; |
| 141 super.new(); | 285 dart.setSignature(src__iterable_matchers._AnyElement, { |
| 142 } | 286 constructors: () => ({new: dart.definiteFunctionType(src__iterable_matchers.
_AnyElement, [src__interfaces.Matcher])}), |
| 143 featureValueOf(actual) { | 287 methods: () => ({ |
| 144 return actual; | 288 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), |
| 145 } | 289 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) |
| 146 matches(item, matchState) { | 290 }) |
| 147 let f = this.featureValueOf(item); | 291 }); |
| 148 if (dart.test(this[_matcher].matches(f, matchState))) return true; | 292 src__iterable_matchers.orderedEquals = function(expected) { |
| 149 src__util.addStateInfo(matchState, dart.map({feature: f})); | 293 return new src__iterable_matchers._OrderedEquals(expected); |
| 150 return false; | 294 }; |
| 151 } | 295 dart.fn(src__iterable_matchers.orderedEquals, IterableToMatcher()); |
| 152 describe(description) { | 296 const _expected = Symbol('_expected'); |
| 153 return description.add(this[_featureDescription]).add(' ').addDescriptionO
f(this[_matcher]); | 297 src__iterable_matchers._OrderedEquals = class _OrderedEquals extends src__inte
rfaces.Matcher { |
| 154 } | 298 new(expected) { |
| 155 describeMismatch(item, mismatchDescription, matchState, verbose) { | 299 this[_expected] = expected; |
| 156 mismatchDescription.add('has ').add(this[_featureName]).add(' with value '
).addDescriptionOf(matchState[dartx.get]('feature')); | 300 this[_matcher$] = null; |
| 157 let innerDescription = new src__description.StringDescription(); | 301 super.new(); |
| 158 this[_matcher].describeMismatch(matchState[dartx.get]('feature'), innerDes
cription, core.Map._check(matchState[dartx.get]('state')), verbose); | 302 this[_matcher$] = src__core_matchers.equals(this[_expected], 1); |
| 159 if (dart.notNull(innerDescription.length) > 0) { | 303 } |
| 160 mismatchDescription.add(' which ').add(innerDescription.toString()); | 304 matches(item, matchState) { |
| 161 } | 305 return core.Iterable.is(item) && dart.test(this[_matcher$].matches(item, m
atchState)); |
| 162 return mismatchDescription; | 306 } |
| 163 } | 307 describe(description) { |
| 164 }; | 308 return description.add('equals ').addDescriptionOf(this[_expected]).add('
ordered'); |
| 165 dart.setSignature(src__core_matchers.CustomMatcher, { | 309 } |
| 166 constructors: () => ({new: dart.definiteFunctionType(src__core_matchers.Cust
omMatcher, [core.String, core.String, dart.dynamic])}), | 310 describeMismatch(item, mismatchDescription, matchState, verbose) { |
| 167 methods: () => ({ | 311 if (!core.Iterable.is(item)) { |
| 168 featureValueOf: dart.definiteFunctionType(dart.dynamic, [dart.dynamic]), | 312 return mismatchDescription.add('is not an Iterable'); |
| 169 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), | 313 } else { |
| 170 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) | 314 return this[_matcher$].describeMismatch(item, mismatchDescription, match
State, verbose); |
| 171 }) | 315 } |
| 172 }); | 316 } |
| 173 matcher.CustomMatcher = src__core_matchers.CustomMatcher; | 317 }; |
| 174 const _name = Symbol('_name'); | 318 dart.setSignature(src__iterable_matchers._OrderedEquals, { |
| 319 constructors: () => ({new: dart.definiteFunctionType(src__iterable_matchers.
_OrderedEquals, [core.Iterable])}), |
| 320 methods: () => ({ |
| 321 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), |
| 322 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) |
| 323 }) |
| 324 }); |
| 325 src__iterable_matchers.unorderedEquals = function(expected) { |
| 326 return new src__iterable_matchers._UnorderedEquals(expected); |
| 327 }; |
| 328 dart.fn(src__iterable_matchers.unorderedEquals, IterableToMatcher()); |
| 329 const _expectedValues = Symbol('_expectedValues'); |
| 330 const _test = Symbol('_test'); |
| 331 src__iterable_matchers._UnorderedMatches = class _UnorderedMatches extends src
__interfaces.Matcher { |
| 332 new(expected) { |
| 333 this[_expected] = expected[dartx.map](src__interfaces.Matcher)(src__util.w
rapMatcher)[dartx.toList](); |
| 334 super.new(); |
| 335 } |
| 336 [_test](item) { |
| 337 if (!core.Iterable.is(item)) return 'not iterable'; |
| 338 item = dart.dsend(item, 'toList'); |
| 339 if (dart.notNull(this[_expected][dartx.length]) > dart.notNull(core.num._c
heck(dart.dload(item, 'length')))) { |
| 340 return dart.str`has too few elements (${dart.dload(item, 'length')} < ${
this[_expected][dartx.length]})`; |
| 341 } else if (dart.notNull(this[_expected][dartx.length]) < dart.notNull(core
.num._check(dart.dload(item, 'length')))) { |
| 342 return dart.str`has too many elements (${dart.dload(item, 'length')} > $
{this[_expected][dartx.length]})`; |
| 343 } |
| 344 let matched = ListOfbool().filled(core.int._check(dart.dload(item, 'length
')), false); |
| 345 let expectedPosition = 0; |
| 346 for (let expectedMatcher of this[_expected]) { |
| 347 let actualPosition = 0; |
| 348 let gotMatch = false; |
| 349 for (let actualElement of core.Iterable._check(item)) { |
| 350 if (!dart.test(matched[dartx.get](actualPosition))) { |
| 351 if (dart.test(expectedMatcher.matches(actualElement, dart.map()))) { |
| 352 matched[dartx.set](actualPosition, gotMatch = true); |
| 353 break; |
| 354 } |
| 355 } |
| 356 ++actualPosition; |
| 357 } |
| 358 if (!gotMatch) { |
| 359 return dart.toString(new src__description.StringDescription().add('has
no match for ').addDescriptionOf(expectedMatcher).add(dart.str` at index ${expe
ctedPosition}`)); |
| 360 } |
| 361 ++expectedPosition; |
| 362 } |
| 363 return null; |
| 364 } |
| 365 matches(item, mismatchState) { |
| 366 return this[_test](item) == null; |
| 367 } |
| 368 describe(description) { |
| 369 return description.add('matches ').addAll('[', ', ', ']', this[_expected])
.add(' unordered'); |
| 370 } |
| 371 describeMismatch(item, mismatchDescription, matchState, verbose) { |
| 372 return mismatchDescription.add(this[_test](item)); |
| 373 } |
| 374 }; |
| 375 dart.setSignature(src__iterable_matchers._UnorderedMatches, { |
| 376 constructors: () => ({new: dart.definiteFunctionType(src__iterable_matchers.
_UnorderedMatches, [core.Iterable])}), |
| 377 methods: () => ({ |
| 378 [_test]: dart.definiteFunctionType(core.String, [dart.dynamic]), |
| 379 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), |
| 380 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) |
| 381 }) |
| 382 }); |
| 383 src__iterable_matchers._UnorderedEquals = class _UnorderedEquals extends src__
iterable_matchers._UnorderedMatches { |
| 384 new(expected) { |
| 385 this[_expectedValues] = expected[dartx.toList](); |
| 386 super.new(expected[dartx.map](src__interfaces.Matcher)(src__core_matchers.
equals)); |
| 387 } |
| 388 describe(description) { |
| 389 return description.add('equals ').addDescriptionOf(this[_expectedValues]).
add(' unordered'); |
| 390 } |
| 391 }; |
| 392 dart.setSignature(src__iterable_matchers._UnorderedEquals, { |
| 393 constructors: () => ({new: dart.definiteFunctionType(src__iterable_matchers.
_UnorderedEquals, [core.Iterable])}) |
| 394 }); |
| 395 src__iterable_matchers.unorderedMatches = function(expected) { |
| 396 return new src__iterable_matchers._UnorderedMatches(expected); |
| 397 }; |
| 398 dart.fn(src__iterable_matchers.unorderedMatches, IterableToMatcher()); |
| 399 src__iterable_matchers.pairwiseCompare = function(expected, comparator, descri
ption) { |
| 400 return new src__iterable_matchers._PairwiseCompare(expected, comparator, des
cription); |
| 401 }; |
| 402 dart.fn(src__iterable_matchers.pairwiseCompare, IterableAndFnAndStringToMatche
r()); |
| 403 src__iterable_matchers._Comparator = dart.typedef('_Comparator', () => dart.fu
nctionType(core.bool, [dart.dynamic, dart.dynamic])); |
| 404 const _comparator = Symbol('_comparator'); |
| 405 const _description = Symbol('_description'); |
| 406 src__iterable_matchers._PairwiseCompare = class _PairwiseCompare extends src__
iterable_matchers._IterableMatcher { |
| 407 new(expected, comparator, description) { |
| 408 this[_expected] = expected; |
| 409 this[_comparator] = comparator; |
| 410 this[_description] = description; |
| 411 super.new(); |
| 412 } |
| 413 matches(item, matchState) { |
| 414 if (!core.Iterable.is(item)) return false; |
| 415 if (!dart.equals(dart.dload(item, 'length'), this[_expected][dartx.length]
)) return false; |
| 416 let iterator = dart.dload(item, 'iterator'); |
| 417 let i = 0; |
| 418 for (let e of this[_expected]) { |
| 419 dart.dsend(iterator, 'moveNext'); |
| 420 if (!dart.test(dart.dcall(this[_comparator], e, dart.dload(iterator, 'cu
rrent')))) { |
| 421 src__util.addStateInfo(matchState, dart.map({index: i, expected: e, ac
tual: dart.dload(iterator, 'current')})); |
| 422 return false; |
| 423 } |
| 424 i++; |
| 425 } |
| 426 return true; |
| 427 } |
| 428 describe(description) { |
| 429 return description.add(dart.str`pairwise ${this[_description]} `).addDescr
iptionOf(this[_expected]); |
| 430 } |
| 431 describeMismatch(item, mismatchDescription, matchState, verbose) { |
| 432 if (!core.Iterable.is(item)) { |
| 433 return mismatchDescription.add('is not an Iterable'); |
| 434 } else if (!dart.equals(dart.dload(item, 'length'), this[_expected][dartx.
length])) { |
| 435 return mismatchDescription.add(dart.str`has length ${dart.dload(item, 'l
ength')} instead of ${this[_expected][dartx.length]}`); |
| 436 } else { |
| 437 return mismatchDescription.add('has ').addDescriptionOf(matchState[dartx
.get]("actual")).add(dart.str` which is not ${this[_description]} `).addDescript
ionOf(matchState[dartx.get]("expected")).add(dart.str` at index ${matchState[dar
tx.get]("index")}`); |
| 438 } |
| 439 } |
| 440 }; |
| 441 dart.setSignature(src__iterable_matchers._PairwiseCompare, { |
| 442 constructors: () => ({new: dart.definiteFunctionType(src__iterable_matchers.
_PairwiseCompare, [core.Iterable, src__iterable_matchers._Comparator, core.Strin
g])}), |
| 443 methods: () => ({ |
| 444 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), |
| 445 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) |
| 446 }) |
| 447 }); |
| 448 src__map_matchers.containsValue = function(value) { |
| 449 return new src__map_matchers._ContainsValue(value); |
| 450 }; |
| 451 dart.fn(src__map_matchers.containsValue, dynamicToMatcher()); |
| 452 const _value = Symbol('_value'); |
| 453 src__map_matchers._ContainsValue = class _ContainsValue extends src__interface
s.Matcher { |
| 454 new(value) { |
| 455 this[_value] = value; |
| 456 super.new(); |
| 457 } |
| 458 matches(item, matchState) { |
| 459 return core.bool._check(dart.dsend(item, 'containsValue', this[_value])); |
| 460 } |
| 461 describe(description) { |
| 462 return description.add('contains value ').addDescriptionOf(this[_value]); |
| 463 } |
| 464 }; |
| 465 dart.setSignature(src__map_matchers._ContainsValue, { |
| 466 constructors: () => ({new: dart.definiteFunctionType(src__map_matchers._Cont
ainsValue, [dart.dynamic])}), |
| 467 methods: () => ({ |
| 468 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), |
| 469 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) |
| 470 }) |
| 471 }); |
| 472 src__map_matchers.containsPair = function(key, value) { |
| 473 return new src__map_matchers._ContainsMapping(key, src__util.wrapMatcher(val
ue)); |
| 474 }; |
| 475 dart.fn(src__map_matchers.containsPair, dynamicAnddynamicToMatcher()); |
| 476 const _key = Symbol('_key'); |
| 477 const _valueMatcher = Symbol('_valueMatcher'); |
| 478 src__map_matchers._ContainsMapping = class _ContainsMapping extends src__inter
faces.Matcher { |
| 479 new(key, valueMatcher) { |
| 480 this[_key] = key; |
| 481 this[_valueMatcher] = valueMatcher; |
| 482 super.new(); |
| 483 } |
| 484 matches(item, matchState) { |
| 485 return dart.test(dart.dsend(item, 'containsKey', this[_key])) && dart.test
(this[_valueMatcher].matches(dart.dindex(item, this[_key]), matchState)); |
| 486 } |
| 487 describe(description) { |
| 488 return description.add('contains pair ').addDescriptionOf(this[_key]).add(
' => ').addDescriptionOf(this[_valueMatcher]); |
| 489 } |
| 490 describeMismatch(item, mismatchDescription, matchState, verbose) { |
| 491 if (!dart.test(dart.dsend(item, 'containsKey', this[_key]))) { |
| 492 return mismatchDescription.add(" doesn't contain key ").addDescriptionOf
(this[_key]); |
| 493 } else { |
| 494 mismatchDescription.add(' contains key ').addDescriptionOf(this[_key]).a
dd(' but with value '); |
| 495 this[_valueMatcher].describeMismatch(dart.dindex(item, this[_key]), mism
atchDescription, matchState, verbose); |
| 496 return mismatchDescription; |
| 497 } |
| 498 } |
| 499 }; |
| 500 dart.setSignature(src__map_matchers._ContainsMapping, { |
| 501 constructors: () => ({new: dart.definiteFunctionType(src__map_matchers._Cont
ainsMapping, [dart.dynamic, src__interfaces.Matcher])}), |
| 502 methods: () => ({ |
| 503 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), |
| 504 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) |
| 505 }) |
| 506 }); |
| 507 const _name$ = Symbol('_name'); |
| 175 src__core_matchers.TypeMatcher = class TypeMatcher extends src__interfaces.Mat
cher { | 508 src__core_matchers.TypeMatcher = class TypeMatcher extends src__interfaces.Mat
cher { |
| 176 new(name) { | 509 new(name) { |
| 177 this[_name] = name; | 510 this[_name$] = name; |
| 178 super.new(); | 511 super.new(); |
| 179 } | 512 } |
| 180 describe(description) { | 513 describe(description) { |
| 181 return description.add(this[_name]); | 514 return description.add(this[_name$]); |
| 182 } | 515 } |
| 183 }; | 516 }; |
| 184 dart.setSignature(src__core_matchers.TypeMatcher, { | 517 dart.setSignature(src__core_matchers.TypeMatcher, { |
| 185 constructors: () => ({new: dart.definiteFunctionType(src__core_matchers.Type
Matcher, [core.String])}), | 518 constructors: () => ({new: dart.definiteFunctionType(src__core_matchers.Type
Matcher, [core.String])}), |
| 186 methods: () => ({describe: dart.definiteFunctionType(src__interfaces.Descrip
tion, [src__interfaces.Description])}) | 519 methods: () => ({describe: dart.definiteFunctionType(src__interfaces.Descrip
tion, [src__interfaces.Description])}) |
| 187 }); | 520 }); |
| 188 src__core_matchers._IsList = class _IsList extends src__core_matchers.TypeMatc
her { | 521 src__error_matchers._ArgumentError = class _ArgumentError extends src__core_ma
tchers.TypeMatcher { |
| 189 new() { | 522 new() { |
| 190 super.new("List"); | 523 super.new("ArgumentError"); |
| 191 } | 524 } |
| 192 matches(item, matchState) { | 525 matches(item, matchState) { |
| 193 return core.List.is(item); | 526 return core.ArgumentError.is(item); |
| 194 } | 527 } |
| 195 }; | 528 }; |
| 196 dart.setSignature(src__core_matchers._IsList, { | 529 dart.setSignature(src__error_matchers._ArgumentError, { |
| 197 constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._IsL
ist, [])}), | 530 constructors: () => ({new: dart.definiteFunctionType(src__error_matchers._Ar
gumentError, [])}), |
| 198 methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic
, core.Map])}) | 531 methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic
, core.Map])}) |
| 199 }); | 532 }); |
| 200 src__core_matchers.isList = dart.const(new src__core_matchers._IsList()); | 533 src__error_matchers.isArgumentError = dart.const(new src__error_matchers._Argu
mentError()); |
| 201 matcher.isList = src__core_matchers.isList; | |
| 202 src__core_matchers.predicate = function(f, description) { | |
| 203 if (description === void 0) description = 'satisfies function'; | |
| 204 return new src__core_matchers._Predicate(f, description); | |
| 205 }; | |
| 206 dart.fn(src__core_matchers.predicate, Fn__ToMatcher()); | |
| 207 matcher.predicate = src__core_matchers.predicate; | |
| 208 src__core_matchers._IsNotNull = class _IsNotNull extends src__interfaces.Match
er { | |
| 209 new() { | |
| 210 super.new(); | |
| 211 } | |
| 212 matches(item, matchState) { | |
| 213 return item != null; | |
| 214 } | |
| 215 describe(description) { | |
| 216 return description.add('not null'); | |
| 217 } | |
| 218 }; | |
| 219 dart.setSignature(src__core_matchers._IsNotNull, { | |
| 220 constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._IsN
otNull, [])}), | |
| 221 methods: () => ({ | |
| 222 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), | |
| 223 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) | |
| 224 }) | |
| 225 }); | |
| 226 src__core_matchers.isNotNull = dart.const(new src__core_matchers._IsNotNull())
; | |
| 227 matcher.isNotNull = src__core_matchers.isNotNull; | |
| 228 src__core_matchers.hasLength = function(matcher) { | |
| 229 return new src__core_matchers._HasLength(src__util.wrapMatcher(matcher)); | |
| 230 }; | |
| 231 dart.fn(src__core_matchers.hasLength, dynamicToMatcher()); | |
| 232 matcher.hasLength = src__core_matchers.hasLength; | |
| 233 src__core_matchers.isInstanceOf$ = dart.generic(T => { | |
| 234 class isInstanceOf extends src__interfaces.Matcher { | |
| 235 new() { | |
| 236 super.new(); | |
| 237 } | |
| 238 matches(obj, matchState) { | |
| 239 return T.is(obj); | |
| 240 } | |
| 241 describe(description) { | |
| 242 return description.add(dart.str`an instance of ${dart.wrapType(T)}`); | |
| 243 } | |
| 244 } | |
| 245 dart.addTypeTests(isInstanceOf); | |
| 246 dart.setSignature(isInstanceOf, { | |
| 247 constructors: () => ({new: dart.definiteFunctionType(src__core_matchers.is
InstanceOf$(T), [])}), | |
| 248 methods: () => ({ | |
| 249 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), | |
| 250 describe: dart.definiteFunctionType(src__interfaces.Description, [src__i
nterfaces.Description]) | |
| 251 }) | |
| 252 }); | |
| 253 return isInstanceOf; | |
| 254 }); | |
| 255 src__core_matchers.isInstanceOf = isInstanceOf(); | |
| 256 matcher.isInstanceOf$ = src__core_matchers.isInstanceOf$; | |
| 257 matcher.isInstanceOf = src__core_matchers.isInstanceOf; | |
| 258 src__core_matchers._IsNaN = class _IsNaN extends src__interfaces.Matcher { | |
| 259 new() { | |
| 260 super.new(); | |
| 261 } | |
| 262 matches(item, matchState) { | |
| 263 return core.double.NAN[dartx.compareTo](core.num._check(item)) == 0; | |
| 264 } | |
| 265 describe(description) { | |
| 266 return description.add('NaN'); | |
| 267 } | |
| 268 }; | |
| 269 dart.setSignature(src__core_matchers._IsNaN, { | |
| 270 constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._IsN
aN, [])}), | |
| 271 methods: () => ({ | |
| 272 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), | |
| 273 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) | |
| 274 }) | |
| 275 }); | |
| 276 src__core_matchers.isNaN = dart.const(new src__core_matchers._IsNaN()); | |
| 277 matcher.isNaN = src__core_matchers.isNaN; | |
| 278 src__core_matchers._ReturnsNormally = class _ReturnsNormally extends src__inte
rfaces.Matcher { | |
| 279 new() { | |
| 280 super.new(); | |
| 281 } | |
| 282 matches(f, matchState) { | |
| 283 try { | |
| 284 dart.dcall(f); | |
| 285 return true; | |
| 286 } catch (e) { | |
| 287 let s = dart.stackTrace(e); | |
| 288 src__util.addStateInfo(matchState, dart.map({exception: e, stack: s})); | |
| 289 return false; | |
| 290 } | |
| 291 | |
| 292 } | |
| 293 describe(description) { | |
| 294 return description.add("return normally"); | |
| 295 } | |
| 296 describeMismatch(item, mismatchDescription, matchState, verbose) { | |
| 297 mismatchDescription.add('threw ').addDescriptionOf(matchState[dartx.get]('
exception')); | |
| 298 if (dart.test(verbose)) { | |
| 299 mismatchDescription.add(' at ').add(dart.toString(matchState[dartx.get](
'stack'))); | |
| 300 } | |
| 301 return mismatchDescription; | |
| 302 } | |
| 303 }; | |
| 304 dart.setSignature(src__core_matchers._ReturnsNormally, { | |
| 305 constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._Ret
urnsNormally, [])}), | |
| 306 methods: () => ({ | |
| 307 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), | |
| 308 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) | |
| 309 }) | |
| 310 }); | |
| 311 src__core_matchers.returnsNormally = dart.const(new src__core_matchers._Return
sNormally()); | |
| 312 matcher.returnsNormally = src__core_matchers.returnsNormally; | |
| 313 src__core_matchers._IsAnything = class _IsAnything extends src__interfaces.Mat
cher { | |
| 314 new() { | |
| 315 super.new(); | |
| 316 } | |
| 317 matches(item, matchState) { | |
| 318 return true; | |
| 319 } | |
| 320 describe(description) { | |
| 321 return description.add('anything'); | |
| 322 } | |
| 323 }; | |
| 324 dart.setSignature(src__core_matchers._IsAnything, { | |
| 325 constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._IsA
nything, [])}), | |
| 326 methods: () => ({ | |
| 327 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), | |
| 328 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) | |
| 329 }) | |
| 330 }); | |
| 331 src__core_matchers.anything = dart.const(new src__core_matchers._IsAnything())
; | |
| 332 matcher.anything = src__core_matchers.anything; | |
| 333 matcher.TypeMatcher = src__core_matchers.TypeMatcher; | |
| 334 src__core_matchers.contains = function(expected) { | |
| 335 return new src__core_matchers._Contains(expected); | |
| 336 }; | |
| 337 dart.fn(src__core_matchers.contains, dynamicToMatcher()); | |
| 338 matcher.contains = src__core_matchers.contains; | |
| 339 src__core_matchers._NotEmpty = class _NotEmpty extends src__interfaces.Matcher
{ | |
| 340 new() { | |
| 341 super.new(); | |
| 342 } | |
| 343 matches(item, matchState) { | |
| 344 return core.bool._check(dart.dload(item, 'isNotEmpty')); | |
| 345 } | |
| 346 describe(description) { | |
| 347 return description.add('non-empty'); | |
| 348 } | |
| 349 }; | |
| 350 dart.setSignature(src__core_matchers._NotEmpty, { | |
| 351 constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._Not
Empty, [])}), | |
| 352 methods: () => ({ | |
| 353 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), | |
| 354 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) | |
| 355 }) | |
| 356 }); | |
| 357 src__core_matchers.isNotEmpty = dart.const(new src__core_matchers._NotEmpty())
; | |
| 358 matcher.isNotEmpty = src__core_matchers.isNotEmpty; | |
| 359 src__core_matchers._IsNull = class _IsNull extends src__interfaces.Matcher { | |
| 360 new() { | |
| 361 super.new(); | |
| 362 } | |
| 363 matches(item, matchState) { | |
| 364 return item == null; | |
| 365 } | |
| 366 describe(description) { | |
| 367 return description.add('null'); | |
| 368 } | |
| 369 }; | |
| 370 dart.setSignature(src__core_matchers._IsNull, { | |
| 371 constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._IsN
ull, [])}), | |
| 372 methods: () => ({ | |
| 373 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), | |
| 374 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) | |
| 375 }) | |
| 376 }); | |
| 377 src__core_matchers.isNull = dart.const(new src__core_matchers._IsNull()); | |
| 378 matcher.isNull = src__core_matchers.isNull; | |
| 379 src__core_matchers._IsMap = class _IsMap extends src__core_matchers.TypeMatche
r { | |
| 380 new() { | |
| 381 super.new("Map"); | |
| 382 } | |
| 383 matches(item, matchState) { | |
| 384 return core.Map.is(item); | |
| 385 } | |
| 386 }; | |
| 387 dart.setSignature(src__core_matchers._IsMap, { | |
| 388 constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._IsM
ap, [])}), | |
| 389 methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic
, core.Map])}) | |
| 390 }); | |
| 391 src__core_matchers.isMap = dart.const(new src__core_matchers._IsMap()); | |
| 392 matcher.isMap = src__core_matchers.isMap; | |
| 393 src__core_matchers._IsNotNaN = class _IsNotNaN extends src__interfaces.Matcher
{ | |
| 394 new() { | |
| 395 super.new(); | |
| 396 } | |
| 397 matches(item, matchState) { | |
| 398 return core.double.NAN[dartx.compareTo](core.num._check(item)) != 0; | |
| 399 } | |
| 400 describe(description) { | |
| 401 return description.add('not NaN'); | |
| 402 } | |
| 403 }; | |
| 404 dart.setSignature(src__core_matchers._IsNotNaN, { | |
| 405 constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._IsN
otNaN, [])}), | |
| 406 methods: () => ({ | |
| 407 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), | |
| 408 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) | |
| 409 }) | |
| 410 }); | |
| 411 src__core_matchers.isNotNaN = dart.const(new src__core_matchers._IsNotNaN()); | |
| 412 matcher.isNotNaN = src__core_matchers.isNotNaN; | |
| 413 src__core_matchers.isIn = function(expected) { | |
| 414 return new src__core_matchers._In(expected); | |
| 415 }; | |
| 416 dart.fn(src__core_matchers.isIn, dynamicToMatcher()); | |
| 417 matcher.isIn = src__core_matchers.isIn; | |
| 418 const _out = Symbol('_out'); | |
| 419 src__description.StringDescription = class StringDescription extends core.Obje
ct { | |
| 420 new(init) { | |
| 421 if (init === void 0) init = ''; | |
| 422 this[_out] = new core.StringBuffer(); | |
| 423 this[_out].write(init); | |
| 424 } | |
| 425 get length() { | |
| 426 return this[_out].length; | |
| 427 } | |
| 428 toString() { | |
| 429 return dart.toString(this[_out]); | |
| 430 } | |
| 431 add(text) { | |
| 432 this[_out].write(text); | |
| 433 return this; | |
| 434 } | |
| 435 replace(text) { | |
| 436 this[_out].clear(); | |
| 437 return this.add(text); | |
| 438 } | |
| 439 addDescriptionOf(value) { | |
| 440 if (src__interfaces.Matcher.is(value)) { | |
| 441 value.describe(this); | |
| 442 } else { | |
| 443 this.add(src__pretty_print.prettyPrint(value, {maxLineLength: 80, maxIte
ms: 25})); | |
| 444 } | |
| 445 return this; | |
| 446 } | |
| 447 addAll(start, separator, end, list) { | |
| 448 let separate = false; | |
| 449 this.add(start); | |
| 450 for (let item of list) { | |
| 451 if (separate) { | |
| 452 this.add(separator); | |
| 453 } | |
| 454 this.addDescriptionOf(item); | |
| 455 separate = true; | |
| 456 } | |
| 457 this.add(end); | |
| 458 return this; | |
| 459 } | |
| 460 }; | |
| 461 src__description.StringDescription[dart.implements] = () => [src__interfaces.D
escription]; | |
| 462 dart.setSignature(src__description.StringDescription, { | |
| 463 constructors: () => ({new: dart.definiteFunctionType(src__description.String
Description, [], [core.String])}), | |
| 464 methods: () => ({ | |
| 465 add: dart.definiteFunctionType(src__interfaces.Description, [core.String])
, | |
| 466 replace: dart.definiteFunctionType(src__interfaces.Description, [core.Stri
ng]), | |
| 467 addDescriptionOf: dart.definiteFunctionType(src__interfaces.Description, [
dart.dynamic]), | |
| 468 addAll: dart.definiteFunctionType(src__interfaces.Description, [core.Strin
g, core.String, core.String, core.Iterable]) | |
| 469 }) | |
| 470 }); | |
| 471 matcher.StringDescription = src__description.StringDescription; | |
| 472 src__error_matchers._ConcurrentModificationError = class _ConcurrentModificati
onError extends src__core_matchers.TypeMatcher { | 534 src__error_matchers._ConcurrentModificationError = class _ConcurrentModificati
onError extends src__core_matchers.TypeMatcher { |
| 473 new() { | 535 new() { |
| 474 super.new("ConcurrentModificationError"); | 536 super.new("ConcurrentModificationError"); |
| 475 } | 537 } |
| 476 matches(item, matchState) { | 538 matches(item, matchState) { |
| 477 return core.ConcurrentModificationError.is(item); | 539 return core.ConcurrentModificationError.is(item); |
| 478 } | 540 } |
| 479 }; | 541 }; |
| 480 dart.setSignature(src__error_matchers._ConcurrentModificationError, { | 542 dart.setSignature(src__error_matchers._ConcurrentModificationError, { |
| 481 constructors: () => ({new: dart.definiteFunctionType(src__error_matchers._Co
ncurrentModificationError, [])}), | 543 constructors: () => ({new: dart.definiteFunctionType(src__error_matchers._Co
ncurrentModificationError, [])}), |
| 482 methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic
, core.Map])}) | 544 methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic
, core.Map])}) |
| 483 }); | 545 }); |
| 484 src__error_matchers.isConcurrentModificationError = dart.const(new src__error_
matchers._ConcurrentModificationError()); | 546 src__error_matchers.isConcurrentModificationError = dart.const(new src__error_
matchers._ConcurrentModificationError()); |
| 485 matcher.isConcurrentModificationError = src__error_matchers.isConcurrentModifi
cationError; | |
| 486 src__error_matchers._CyclicInitializationError = class _CyclicInitializationEr
ror extends src__core_matchers.TypeMatcher { | 547 src__error_matchers._CyclicInitializationError = class _CyclicInitializationEr
ror extends src__core_matchers.TypeMatcher { |
| 487 new() { | 548 new() { |
| 488 super.new("CyclicInitializationError"); | 549 super.new("CyclicInitializationError"); |
| 489 } | 550 } |
| 490 matches(item, matchState) { | 551 matches(item, matchState) { |
| 491 return core.CyclicInitializationError.is(item); | 552 return core.CyclicInitializationError.is(item); |
| 492 } | 553 } |
| 493 }; | 554 }; |
| 494 dart.setSignature(src__error_matchers._CyclicInitializationError, { | 555 dart.setSignature(src__error_matchers._CyclicInitializationError, { |
| 495 constructors: () => ({new: dart.definiteFunctionType(src__error_matchers._Cy
clicInitializationError, [])}), | 556 constructors: () => ({new: dart.definiteFunctionType(src__error_matchers._Cy
clicInitializationError, [])}), |
| 496 methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic
, core.Map])}) | 557 methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic
, core.Map])}) |
| 497 }); | 558 }); |
| 498 src__error_matchers.isCyclicInitializationError = dart.const(new src__error_ma
tchers._CyclicInitializationError()); | 559 src__error_matchers.isCyclicInitializationError = dart.const(new src__error_ma
tchers._CyclicInitializationError()); |
| 499 matcher.isCyclicInitializationError = src__error_matchers.isCyclicInitializati
onError; | |
| 500 src__error_matchers._ArgumentError = class _ArgumentError extends src__core_ma
tchers.TypeMatcher { | |
| 501 new() { | |
| 502 super.new("ArgumentError"); | |
| 503 } | |
| 504 matches(item, matchState) { | |
| 505 return core.ArgumentError.is(item); | |
| 506 } | |
| 507 }; | |
| 508 dart.setSignature(src__error_matchers._ArgumentError, { | |
| 509 constructors: () => ({new: dart.definiteFunctionType(src__error_matchers._Ar
gumentError, [])}), | |
| 510 methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic
, core.Map])}) | |
| 511 }); | |
| 512 src__error_matchers.isArgumentError = dart.const(new src__error_matchers._Argu
mentError()); | |
| 513 matcher.isArgumentError = src__error_matchers.isArgumentError; | |
| 514 src__error_matchers._Exception = class _Exception extends src__core_matchers.T
ypeMatcher { | 560 src__error_matchers._Exception = class _Exception extends src__core_matchers.T
ypeMatcher { |
| 515 new() { | 561 new() { |
| 516 super.new("Exception"); | 562 super.new("Exception"); |
| 517 } | 563 } |
| 518 matches(item, matchState) { | 564 matches(item, matchState) { |
| 519 return core.Exception.is(item); | 565 return core.Exception.is(item); |
| 520 } | 566 } |
| 521 }; | 567 }; |
| 522 dart.setSignature(src__error_matchers._Exception, { | 568 dart.setSignature(src__error_matchers._Exception, { |
| 523 constructors: () => ({new: dart.definiteFunctionType(src__error_matchers._Ex
ception, [])}), | 569 constructors: () => ({new: dart.definiteFunctionType(src__error_matchers._Ex
ception, [])}), |
| 524 methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic
, core.Map])}) | 570 methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic
, core.Map])}) |
| 525 }); | 571 }); |
| 526 src__error_matchers.isException = dart.const(new src__error_matchers._Exceptio
n()); | 572 src__error_matchers.isException = dart.const(new src__error_matchers._Exceptio
n()); |
| 527 matcher.isException = src__error_matchers.isException; | 573 src__error_matchers._FormatException = class _FormatException extends src__cor
e_matchers.TypeMatcher { |
| 574 new() { |
| 575 super.new("FormatException"); |
| 576 } |
| 577 matches(item, matchState) { |
| 578 return core.FormatException.is(item); |
| 579 } |
| 580 }; |
| 581 dart.setSignature(src__error_matchers._FormatException, { |
| 582 constructors: () => ({new: dart.definiteFunctionType(src__error_matchers._Fo
rmatException, [])}), |
| 583 methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic
, core.Map])}) |
| 584 }); |
| 585 src__error_matchers.isFormatException = dart.const(new src__error_matchers._Fo
rmatException()); |
| 586 src__error_matchers._NoSuchMethodError = class _NoSuchMethodError extends src_
_core_matchers.TypeMatcher { |
| 587 new() { |
| 588 super.new("NoSuchMethodError"); |
| 589 } |
| 590 matches(item, matchState) { |
| 591 return core.NoSuchMethodError.is(item); |
| 592 } |
| 593 }; |
| 594 dart.setSignature(src__error_matchers._NoSuchMethodError, { |
| 595 constructors: () => ({new: dart.definiteFunctionType(src__error_matchers._No
SuchMethodError, [])}), |
| 596 methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic
, core.Map])}) |
| 597 }); |
| 598 src__error_matchers.isNoSuchMethodError = dart.const(new src__error_matchers._
NoSuchMethodError()); |
| 528 src__error_matchers._NullThrownError = class _NullThrownError extends src__cor
e_matchers.TypeMatcher { | 599 src__error_matchers._NullThrownError = class _NullThrownError extends src__cor
e_matchers.TypeMatcher { |
| 529 new() { | 600 new() { |
| 530 super.new("NullThrownError"); | 601 super.new("NullThrownError"); |
| 531 } | 602 } |
| 532 matches(item, matchState) { | 603 matches(item, matchState) { |
| 533 return core.NullThrownError.is(item); | 604 return core.NullThrownError.is(item); |
| 534 } | 605 } |
| 535 }; | 606 }; |
| 536 dart.setSignature(src__error_matchers._NullThrownError, { | 607 dart.setSignature(src__error_matchers._NullThrownError, { |
| 537 constructors: () => ({new: dart.definiteFunctionType(src__error_matchers._Nu
llThrownError, [])}), | 608 constructors: () => ({new: dart.definiteFunctionType(src__error_matchers._Nu
llThrownError, [])}), |
| 538 methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic
, core.Map])}) | 609 methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic
, core.Map])}) |
| 539 }); | 610 }); |
| 540 src__error_matchers.isNullThrownError = dart.const(new src__error_matchers._Nu
llThrownError()); | 611 src__error_matchers.isNullThrownError = dart.const(new src__error_matchers._Nu
llThrownError()); |
| 541 matcher.isNullThrownError = src__error_matchers.isNullThrownError; | |
| 542 src__error_matchers._RangeError = class _RangeError extends src__core_matchers
.TypeMatcher { | 612 src__error_matchers._RangeError = class _RangeError extends src__core_matchers
.TypeMatcher { |
| 543 new() { | 613 new() { |
| 544 super.new("RangeError"); | 614 super.new("RangeError"); |
| 545 } | 615 } |
| 546 matches(item, matchState) { | 616 matches(item, matchState) { |
| 547 return core.RangeError.is(item); | 617 return core.RangeError.is(item); |
| 548 } | 618 } |
| 549 }; | 619 }; |
| 550 dart.setSignature(src__error_matchers._RangeError, { | 620 dart.setSignature(src__error_matchers._RangeError, { |
| 551 constructors: () => ({new: dart.definiteFunctionType(src__error_matchers._Ra
ngeError, [])}), | 621 constructors: () => ({new: dart.definiteFunctionType(src__error_matchers._Ra
ngeError, [])}), |
| 552 methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic
, core.Map])}) | 622 methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic
, core.Map])}) |
| 553 }); | 623 }); |
| 554 src__error_matchers.isRangeError = dart.const(new src__error_matchers._RangeEr
ror()); | 624 src__error_matchers.isRangeError = dart.const(new src__error_matchers._RangeEr
ror()); |
| 555 matcher.isRangeError = src__error_matchers.isRangeError; | |
| 556 src__error_matchers._FormatException = class _FormatException extends src__cor
e_matchers.TypeMatcher { | |
| 557 new() { | |
| 558 super.new("FormatException"); | |
| 559 } | |
| 560 matches(item, matchState) { | |
| 561 return core.FormatException.is(item); | |
| 562 } | |
| 563 }; | |
| 564 dart.setSignature(src__error_matchers._FormatException, { | |
| 565 constructors: () => ({new: dart.definiteFunctionType(src__error_matchers._Fo
rmatException, [])}), | |
| 566 methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic
, core.Map])}) | |
| 567 }); | |
| 568 src__error_matchers.isFormatException = dart.const(new src__error_matchers._Fo
rmatException()); | |
| 569 matcher.isFormatException = src__error_matchers.isFormatException; | |
| 570 src__error_matchers._StateError = class _StateError extends src__core_matchers
.TypeMatcher { | 625 src__error_matchers._StateError = class _StateError extends src__core_matchers
.TypeMatcher { |
| 571 new() { | 626 new() { |
| 572 super.new("StateError"); | 627 super.new("StateError"); |
| 573 } | 628 } |
| 574 matches(item, matchState) { | 629 matches(item, matchState) { |
| 575 return core.StateError.is(item); | 630 return core.StateError.is(item); |
| 576 } | 631 } |
| 577 }; | 632 }; |
| 578 dart.setSignature(src__error_matchers._StateError, { | 633 dart.setSignature(src__error_matchers._StateError, { |
| 579 constructors: () => ({new: dart.definiteFunctionType(src__error_matchers._St
ateError, [])}), | 634 constructors: () => ({new: dart.definiteFunctionType(src__error_matchers._St
ateError, [])}), |
| 580 methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic
, core.Map])}) | 635 methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic
, core.Map])}) |
| 581 }); | 636 }); |
| 582 src__error_matchers.isStateError = dart.const(new src__error_matchers._StateEr
ror()); | 637 src__error_matchers.isStateError = dart.const(new src__error_matchers._StateEr
ror()); |
| 583 matcher.isStateError = src__error_matchers.isStateError; | |
| 584 src__error_matchers._NoSuchMethodError = class _NoSuchMethodError extends src_
_core_matchers.TypeMatcher { | |
| 585 new() { | |
| 586 super.new("NoSuchMethodError"); | |
| 587 } | |
| 588 matches(item, matchState) { | |
| 589 return core.NoSuchMethodError.is(item); | |
| 590 } | |
| 591 }; | |
| 592 dart.setSignature(src__error_matchers._NoSuchMethodError, { | |
| 593 constructors: () => ({new: dart.definiteFunctionType(src__error_matchers._No
SuchMethodError, [])}), | |
| 594 methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic
, core.Map])}) | |
| 595 }); | |
| 596 src__error_matchers.isNoSuchMethodError = dart.const(new src__error_matchers._
NoSuchMethodError()); | |
| 597 matcher.isNoSuchMethodError = src__error_matchers.isNoSuchMethodError; | |
| 598 src__error_matchers._UnimplementedError = class _UnimplementedError extends sr
c__core_matchers.TypeMatcher { | 638 src__error_matchers._UnimplementedError = class _UnimplementedError extends sr
c__core_matchers.TypeMatcher { |
| 599 new() { | 639 new() { |
| 600 super.new("UnimplementedError"); | 640 super.new("UnimplementedError"); |
| 601 } | 641 } |
| 602 matches(item, matchState) { | 642 matches(item, matchState) { |
| 603 return core.UnimplementedError.is(item); | 643 return core.UnimplementedError.is(item); |
| 604 } | 644 } |
| 605 }; | 645 }; |
| 606 dart.setSignature(src__error_matchers._UnimplementedError, { | 646 dart.setSignature(src__error_matchers._UnimplementedError, { |
| 607 constructors: () => ({new: dart.definiteFunctionType(src__error_matchers._Un
implementedError, [])}), | 647 constructors: () => ({new: dart.definiteFunctionType(src__error_matchers._Un
implementedError, [])}), |
| 608 methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic
, core.Map])}) | 648 methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic
, core.Map])}) |
| 609 }); | 649 }); |
| 610 src__error_matchers.isUnimplementedError = dart.const(new src__error_matchers.
_UnimplementedError()); | 650 src__error_matchers.isUnimplementedError = dart.const(new src__error_matchers.
_UnimplementedError()); |
| 611 matcher.isUnimplementedError = src__error_matchers.isUnimplementedError; | |
| 612 src__error_matchers._UnsupportedError = class _UnsupportedError extends src__c
ore_matchers.TypeMatcher { | 651 src__error_matchers._UnsupportedError = class _UnsupportedError extends src__c
ore_matchers.TypeMatcher { |
| 613 new() { | 652 new() { |
| 614 super.new("UnsupportedError"); | 653 super.new("UnsupportedError"); |
| 615 } | 654 } |
| 616 matches(item, matchState) { | 655 matches(item, matchState) { |
| 617 return core.UnsupportedError.is(item); | 656 return core.UnsupportedError.is(item); |
| 618 } | 657 } |
| 619 }; | 658 }; |
| 620 dart.setSignature(src__error_matchers._UnsupportedError, { | 659 dart.setSignature(src__error_matchers._UnsupportedError, { |
| 621 constructors: () => ({new: dart.definiteFunctionType(src__error_matchers._Un
supportedError, [])}), | 660 constructors: () => ({new: dart.definiteFunctionType(src__error_matchers._Un
supportedError, [])}), |
| 622 methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic
, core.Map])}) | 661 methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic
, core.Map])}) |
| 623 }); | 662 }); |
| 624 src__error_matchers.isUnsupportedError = dart.const(new src__error_matchers._U
nsupportedError()); | 663 src__error_matchers.isUnsupportedError = dart.const(new src__error_matchers._U
nsupportedError()); |
| 625 matcher.isUnsupportedError = src__error_matchers.isUnsupportedError; | 664 const _out = Symbol('_out'); |
| 626 matcher.Matcher = src__interfaces.Matcher; | 665 src__description.StringDescription = class StringDescription extends core.Obje
ct { |
| 627 src__interfaces.Description = class Description extends core.Object {}; | 666 new(init) { |
| 628 matcher.Description = src__interfaces.Description; | 667 if (init === void 0) init = ''; |
| 629 src__iterable_matchers.pairwiseCompare = function(expected, comparator, descri
ption) { | 668 this[_out] = new core.StringBuffer(); |
| 630 return new src__iterable_matchers._PairwiseCompare(expected, comparator, des
cription); | 669 this[_out].write(init); |
| 631 }; | |
| 632 dart.fn(src__iterable_matchers.pairwiseCompare, IterableAndFnAndStringToMatche
r()); | |
| 633 matcher.pairwiseCompare = src__iterable_matchers.pairwiseCompare; | |
| 634 src__iterable_matchers.anyElement = function(matcher) { | |
| 635 return new src__iterable_matchers._AnyElement(src__util.wrapMatcher(matcher)
); | |
| 636 }; | |
| 637 dart.fn(src__iterable_matchers.anyElement, dynamicToMatcher()); | |
| 638 matcher.anyElement = src__iterable_matchers.anyElement; | |
| 639 src__iterable_matchers.orderedEquals = function(expected) { | |
| 640 return new src__iterable_matchers._OrderedEquals(expected); | |
| 641 }; | |
| 642 dart.fn(src__iterable_matchers.orderedEquals, IterableToMatcher()); | |
| 643 matcher.orderedEquals = src__iterable_matchers.orderedEquals; | |
| 644 src__iterable_matchers.unorderedEquals = function(expected) { | |
| 645 return new src__iterable_matchers._UnorderedEquals(expected); | |
| 646 }; | |
| 647 dart.fn(src__iterable_matchers.unorderedEquals, IterableToMatcher()); | |
| 648 matcher.unorderedEquals = src__iterable_matchers.unorderedEquals; | |
| 649 src__iterable_matchers.unorderedMatches = function(expected) { | |
| 650 return new src__iterable_matchers._UnorderedMatches(expected); | |
| 651 }; | |
| 652 dart.fn(src__iterable_matchers.unorderedMatches, IterableToMatcher()); | |
| 653 matcher.unorderedMatches = src__iterable_matchers.unorderedMatches; | |
| 654 src__iterable_matchers.everyElement = function(matcher) { | |
| 655 return new src__iterable_matchers._EveryElement(src__util.wrapMatcher(matche
r)); | |
| 656 }; | |
| 657 dart.fn(src__iterable_matchers.everyElement, dynamicToMatcher()); | |
| 658 matcher.everyElement = src__iterable_matchers.everyElement; | |
| 659 src__map_matchers.containsValue = function(value) { | |
| 660 return new src__map_matchers._ContainsValue(value); | |
| 661 }; | |
| 662 dart.fn(src__map_matchers.containsValue, dynamicToMatcher()); | |
| 663 matcher.containsValue = src__map_matchers.containsValue; | |
| 664 src__map_matchers.containsPair = function(key, value) { | |
| 665 return new src__map_matchers._ContainsMapping(key, src__util.wrapMatcher(val
ue)); | |
| 666 }; | |
| 667 dart.fn(src__map_matchers.containsPair, dynamicAnddynamicToMatcher()); | |
| 668 matcher.containsPair = src__map_matchers.containsPair; | |
| 669 const _value = Symbol('_value'); | |
| 670 const _equalValue = Symbol('_equalValue'); | |
| 671 const _lessThanValue = Symbol('_lessThanValue'); | |
| 672 const _greaterThanValue = Symbol('_greaterThanValue'); | |
| 673 const _comparisonDescription = Symbol('_comparisonDescription'); | |
| 674 const _valueInDescription = Symbol('_valueInDescription'); | |
| 675 src__numeric_matchers._OrderingComparison = class _OrderingComparison extends
src__interfaces.Matcher { | |
| 676 new(value, equalValue, lessThanValue, greaterThanValue, comparisonDescriptio
n, valueInDescription) { | |
| 677 if (valueInDescription === void 0) valueInDescription = true; | |
| 678 this[_value] = value; | |
| 679 this[_equalValue] = equalValue; | |
| 680 this[_lessThanValue] = lessThanValue; | |
| 681 this[_greaterThanValue] = greaterThanValue; | |
| 682 this[_comparisonDescription] = comparisonDescription; | |
| 683 this[_valueInDescription] = valueInDescription; | |
| 684 super.new(); | |
| 685 } | 670 } |
| 686 matches(item, matchState) { | 671 get length() { |
| 687 if (dart.equals(item, this[_value])) { | 672 return this[_out].length; |
| 688 return this[_equalValue]; | 673 } |
| 689 } else if (dart.test(dart.dsend(item, '<', this[_value]))) { | 674 toString() { |
| 690 return this[_lessThanValue]; | 675 return dart.toString(this[_out]); |
| 676 } |
| 677 add(text) { |
| 678 this[_out].write(text); |
| 679 return this; |
| 680 } |
| 681 replace(text) { |
| 682 this[_out].clear(); |
| 683 return this.add(text); |
| 684 } |
| 685 addDescriptionOf(value) { |
| 686 if (src__interfaces.Matcher.is(value)) { |
| 687 value.describe(this); |
| 691 } else { | 688 } else { |
| 692 return this[_greaterThanValue]; | 689 this.add(src__pretty_print.prettyPrint(value, {maxLineLength: 80, maxIte
ms: 25})); |
| 693 } | 690 } |
| 691 return this; |
| 694 } | 692 } |
| 695 describe(description) { | 693 addAll(start, separator, end, list) { |
| 696 if (dart.test(this[_valueInDescription])) { | 694 let separate = false; |
| 697 return description.add(this[_comparisonDescription]).add(' ').addDescrip
tionOf(this[_value]); | 695 this.add(start); |
| 698 } else { | 696 for (let item of list) { |
| 699 return description.add(this[_comparisonDescription]); | 697 if (separate) { |
| 698 this.add(separator); |
| 699 } |
| 700 this.addDescriptionOf(item); |
| 701 separate = true; |
| 700 } | 702 } |
| 701 } | 703 this.add(end); |
| 702 describeMismatch(item, mismatchDescription, matchState, verbose) { | 704 return this; |
| 703 mismatchDescription.add('is not '); | |
| 704 return this.describe(mismatchDescription); | |
| 705 } | 705 } |
| 706 }; | 706 }; |
| 707 dart.setSignature(src__numeric_matchers._OrderingComparison, { | 707 src__description.StringDescription[dart.implements] = () => [src__interfaces.D
escription]; |
| 708 constructors: () => ({new: dart.definiteFunctionType(src__numeric_matchers._
OrderingComparison, [dart.dynamic, core.bool, core.bool, core.bool, core.String]
, [core.bool])}), | 708 dart.setSignature(src__description.StringDescription, { |
| 709 constructors: () => ({new: dart.definiteFunctionType(src__description.String
Description, [], [core.String])}), |
| 709 methods: () => ({ | 710 methods: () => ({ |
| 710 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), | 711 add: dart.definiteFunctionType(src__interfaces.Description, [core.String])
, |
| 711 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) | 712 replace: dart.definiteFunctionType(src__interfaces.Description, [core.Stri
ng]), |
| 713 addDescriptionOf: dart.definiteFunctionType(src__interfaces.Description, [
dart.dynamic]), |
| 714 addAll: dart.definiteFunctionType(src__interfaces.Description, [core.Strin
g, core.String, core.String, core.Iterable]) |
| 712 }) | 715 }) |
| 713 }); | 716 }); |
| 714 src__numeric_matchers.isPositive = dart.const(new src__numeric_matchers._Order
ingComparison(0, false, false, true, 'a positive value', false)); | 717 src__util._Predicate = dart.typedef('_Predicate', () => dart.functionType(core
.bool, [dart.dynamic])); |
| 715 matcher.isPositive = src__numeric_matchers.isPositive; | 718 src__util._escapeMap = dart.const(dart.map({'\n': '\\n', '\r': '\\r', '\f': '\
\f', '\b': '\\b', '\t': '\\t', '\v': '\\v', '': '\\x7F'})); |
| 716 src__numeric_matchers.isZero = dart.const(new src__numeric_matchers._OrderingC
omparison(0, true, false, false, 'a value equal to')); | 719 dart.defineLazy(src__util, { |
| 717 matcher.isZero = src__numeric_matchers.isZero; | 720 get _escapeRegExp() { |
| 718 src__numeric_matchers.inOpenClosedRange = function(low, high) { | 721 return core.RegExp.new(dart.str`[\\x00-\\x07\\x0E-\\x1F${src__util._escape
Map[dartx.keys][dartx.map](core.String)(src__util._getHexLiteral)[dartx.join]()}
]`); |
| 719 return new src__numeric_matchers._InRange(low, high, false, true); | |
| 720 }; | |
| 721 dart.fn(src__numeric_matchers.inOpenClosedRange, numAndnumToMatcher()); | |
| 722 matcher.inOpenClosedRange = src__numeric_matchers.inOpenClosedRange; | |
| 723 src__numeric_matchers.inClosedOpenRange = function(low, high) { | |
| 724 return new src__numeric_matchers._InRange(low, high, true, false); | |
| 725 }; | |
| 726 dart.fn(src__numeric_matchers.inClosedOpenRange, numAndnumToMatcher()); | |
| 727 matcher.inClosedOpenRange = src__numeric_matchers.inClosedOpenRange; | |
| 728 src__numeric_matchers.lessThanOrEqualTo = function(value) { | |
| 729 return new src__numeric_matchers._OrderingComparison(value, true, true, fals
e, 'a value less than or equal to'); | |
| 730 }; | |
| 731 dart.fn(src__numeric_matchers.lessThanOrEqualTo, dynamicToMatcher()); | |
| 732 matcher.lessThanOrEqualTo = src__numeric_matchers.lessThanOrEqualTo; | |
| 733 src__numeric_matchers.isNegative = dart.const(new src__numeric_matchers._Order
ingComparison(0, false, true, false, 'a negative value', false)); | |
| 734 matcher.isNegative = src__numeric_matchers.isNegative; | |
| 735 src__numeric_matchers.inInclusiveRange = function(low, high) { | |
| 736 return new src__numeric_matchers._InRange(low, high, true, true); | |
| 737 }; | |
| 738 dart.fn(src__numeric_matchers.inInclusiveRange, numAndnumToMatcher()); | |
| 739 matcher.inInclusiveRange = src__numeric_matchers.inInclusiveRange; | |
| 740 src__numeric_matchers.lessThan = function(value) { | |
| 741 return new src__numeric_matchers._OrderingComparison(value, false, true, fal
se, 'a value less than'); | |
| 742 }; | |
| 743 dart.fn(src__numeric_matchers.lessThan, dynamicToMatcher()); | |
| 744 matcher.lessThan = src__numeric_matchers.lessThan; | |
| 745 src__numeric_matchers.greaterThan = function(value) { | |
| 746 return new src__numeric_matchers._OrderingComparison(value, false, false, tr
ue, 'a value greater than'); | |
| 747 }; | |
| 748 dart.fn(src__numeric_matchers.greaterThan, dynamicToMatcher()); | |
| 749 matcher.greaterThan = src__numeric_matchers.greaterThan; | |
| 750 src__numeric_matchers.isNonNegative = dart.const(new src__numeric_matchers._Or
deringComparison(0, true, false, true, 'a non-negative value', false)); | |
| 751 matcher.isNonNegative = src__numeric_matchers.isNonNegative; | |
| 752 src__numeric_matchers.inExclusiveRange = function(low, high) { | |
| 753 return new src__numeric_matchers._InRange(low, high, false, false); | |
| 754 }; | |
| 755 dart.fn(src__numeric_matchers.inExclusiveRange, numAndnumToMatcher()); | |
| 756 matcher.inExclusiveRange = src__numeric_matchers.inExclusiveRange; | |
| 757 src__numeric_matchers.closeTo = function(value, delta) { | |
| 758 return new src__numeric_matchers._IsCloseTo(value, delta); | |
| 759 }; | |
| 760 dart.fn(src__numeric_matchers.closeTo, numAndnumToMatcher()); | |
| 761 matcher.closeTo = src__numeric_matchers.closeTo; | |
| 762 src__numeric_matchers.greaterThanOrEqualTo = function(value) { | |
| 763 return new src__numeric_matchers._OrderingComparison(value, true, false, tru
e, 'a value greater than or equal to'); | |
| 764 }; | |
| 765 dart.fn(src__numeric_matchers.greaterThanOrEqualTo, dynamicToMatcher()); | |
| 766 matcher.greaterThanOrEqualTo = src__numeric_matchers.greaterThanOrEqualTo; | |
| 767 src__numeric_matchers.isNonZero = dart.const(new src__numeric_matchers._Orderi
ngComparison(0, false, true, true, 'a value not equal to')); | |
| 768 matcher.isNonZero = src__numeric_matchers.isNonZero; | |
| 769 src__numeric_matchers.isNonPositive = dart.const(new src__numeric_matchers._Or
deringComparison(0, true, true, false, 'a non-positive value', false)); | |
| 770 matcher.isNonPositive = src__numeric_matchers.isNonPositive; | |
| 771 src__operator_matchers.allOf = function(arg0, arg1, arg2, arg3, arg4, arg5, ar
g6) { | |
| 772 if (arg1 === void 0) arg1 = null; | |
| 773 if (arg2 === void 0) arg2 = null; | |
| 774 if (arg3 === void 0) arg3 = null; | |
| 775 if (arg4 === void 0) arg4 = null; | |
| 776 if (arg5 === void 0) arg5 = null; | |
| 777 if (arg6 === void 0) arg6 = null; | |
| 778 return new src__operator_matchers._AllOf(src__operator_matchers._wrapArgs(ar
g0, arg1, arg2, arg3, arg4, arg5, arg6)); | |
| 779 }; | |
| 780 dart.fn(src__operator_matchers.allOf, dynamic__ToMatcher$()); | |
| 781 matcher.allOf = src__operator_matchers.allOf; | |
| 782 src__operator_matchers.isNot = function(matcher) { | |
| 783 return new src__operator_matchers._IsNot(src__util.wrapMatcher(matcher)); | |
| 784 }; | |
| 785 dart.fn(src__operator_matchers.isNot, dynamicToMatcher()); | |
| 786 matcher.isNot = src__operator_matchers.isNot; | |
| 787 src__operator_matchers.anyOf = function(arg0, arg1, arg2, arg3, arg4, arg5, ar
g6) { | |
| 788 if (arg1 === void 0) arg1 = null; | |
| 789 if (arg2 === void 0) arg2 = null; | |
| 790 if (arg3 === void 0) arg3 = null; | |
| 791 if (arg4 === void 0) arg4 = null; | |
| 792 if (arg5 === void 0) arg5 = null; | |
| 793 if (arg6 === void 0) arg6 = null; | |
| 794 return new src__operator_matchers._AnyOf(src__operator_matchers._wrapArgs(ar
g0, arg1, arg2, arg3, arg4, arg5, arg6)); | |
| 795 }; | |
| 796 dart.fn(src__operator_matchers.anyOf, dynamic__ToMatcher$()); | |
| 797 matcher.anyOf = src__operator_matchers.anyOf; | |
| 798 src__string_matchers.endsWith = function(suffixString) { | |
| 799 return new src__string_matchers._StringEndsWith(suffixString); | |
| 800 }; | |
| 801 dart.fn(src__string_matchers.endsWith, StringToMatcher()); | |
| 802 matcher.endsWith = src__string_matchers.endsWith; | |
| 803 src__string_matchers.startsWith = function(prefixString) { | |
| 804 return new src__string_matchers._StringStartsWith(prefixString); | |
| 805 }; | |
| 806 dart.fn(src__string_matchers.startsWith, StringToMatcher()); | |
| 807 matcher.startsWith = src__string_matchers.startsWith; | |
| 808 src__string_matchers.matches = function(re) { | |
| 809 return new src__string_matchers._MatchesRegExp(re); | |
| 810 }; | |
| 811 dart.fn(src__string_matchers.matches, dynamicToMatcher()); | |
| 812 matcher.matches = src__string_matchers.matches; | |
| 813 src__string_matchers.collapseWhitespace = function(string) { | |
| 814 let result = new core.StringBuffer(); | |
| 815 let skipSpace = true; | |
| 816 for (let i = 0; i < dart.notNull(string[dartx.length]); i++) { | |
| 817 let character = string[dartx.get](i); | |
| 818 if (dart.test(src__string_matchers._isWhitespace(character))) { | |
| 819 if (!skipSpace) { | |
| 820 result.write(' '); | |
| 821 skipSpace = true; | |
| 822 } | |
| 823 } else { | |
| 824 result.write(character); | |
| 825 skipSpace = false; | |
| 826 } | |
| 827 } | 722 } |
| 828 return result.toString()[dartx.trim](); | 723 }); |
| 829 }; | |
| 830 dart.fn(src__string_matchers.collapseWhitespace, StringToString()); | |
| 831 matcher.collapseWhitespace = src__string_matchers.collapseWhitespace; | |
| 832 src__string_matchers.equalsIgnoringCase = function(value) { | |
| 833 return new src__string_matchers._IsEqualIgnoringCase(value); | |
| 834 }; | |
| 835 dart.fn(src__string_matchers.equalsIgnoringCase, StringToMatcher()); | |
| 836 matcher.equalsIgnoringCase = src__string_matchers.equalsIgnoringCase; | |
| 837 src__string_matchers.equalsIgnoringWhitespace = function(value) { | |
| 838 return new src__string_matchers._IsEqualIgnoringWhitespace(value); | |
| 839 }; | |
| 840 dart.fn(src__string_matchers.equalsIgnoringWhitespace, StringToMatcher()); | |
| 841 matcher.equalsIgnoringWhitespace = src__string_matchers.equalsIgnoringWhitespa
ce; | |
| 842 src__string_matchers.stringContainsInOrder = function(substrings) { | |
| 843 return new src__string_matchers._StringContainsInOrder(substrings); | |
| 844 }; | |
| 845 dart.fn(src__string_matchers.stringContainsInOrder, ListOfStringToMatcher()); | |
| 846 matcher.stringContainsInOrder = src__string_matchers.stringContainsInOrder; | |
| 847 src__util.addStateInfo = function(matchState, values) { | 724 src__util.addStateInfo = function(matchState, values) { |
| 848 let innerState = core.Map.from(matchState); | 725 let innerState = core.Map.from(matchState); |
| 849 matchState[dartx.clear](); | 726 matchState[dartx.clear](); |
| 850 matchState[dartx.set]('state', innerState); | 727 matchState[dartx.set]('state', innerState); |
| 851 matchState[dartx.addAll](values); | 728 matchState[dartx.addAll](values); |
| 852 }; | 729 }; |
| 853 dart.fn(src__util.addStateInfo, MapAndMapTovoid()); | 730 dart.fn(src__util.addStateInfo, MapAndMapTovoid()); |
| 854 matcher.addStateInfo = src__util.addStateInfo; | |
| 855 src__util.wrapMatcher = function(x) { | 731 src__util.wrapMatcher = function(x) { |
| 856 if (src__interfaces.Matcher.is(x)) { | 732 if (src__interfaces.Matcher.is(x)) { |
| 857 return x; | 733 return x; |
| 858 } else if (src__util._Predicate.is(x)) { | 734 } else if (src__util._Predicate.is(x)) { |
| 859 return src__core_matchers.predicate(x); | 735 return src__core_matchers.predicate(x); |
| 860 } else { | 736 } else { |
| 861 return src__core_matchers.equals(x); | 737 return src__core_matchers.equals(x); |
| 862 } | 738 } |
| 863 }; | 739 }; |
| 864 dart.fn(src__util.wrapMatcher, dynamicToMatcher()); | 740 dart.fn(src__util.wrapMatcher, dynamicToMatcher()); |
| 865 matcher.wrapMatcher = src__util.wrapMatcher; | |
| 866 src__util.escape = function(str) { | 741 src__util.escape = function(str) { |
| 867 str = str[dartx.replaceAll]('\\', '\\\\'); | 742 str = str[dartx.replaceAll]('\\', '\\\\'); |
| 868 return str[dartx.replaceAllMapped](src__util._escapeRegExp, dart.fn(match =>
{ | 743 return str[dartx.replaceAllMapped](src__util._escapeRegExp, dart.fn(match =>
{ |
| 869 let mapped = src__util._escapeMap[dartx.get](match.get(0)); | 744 let mapped = src__util._escapeMap[dartx.get](match.get(0)); |
| 870 if (mapped != null) return mapped; | 745 if (mapped != null) return mapped; |
| 871 return src__util._getHexLiteral(match.get(0)); | 746 return src__util._getHexLiteral(match.get(0)); |
| 872 }, MatchToString())); | 747 }, MatchToString())); |
| 873 }; | 748 }; |
| 874 dart.fn(src__util.escape, StringToString()); | 749 dart.fn(src__util.escape, StringToString()); |
| 875 matcher.escape = src__util.escape; | 750 src__util._getHexLiteral = function(input) { |
| 876 mirror_matchers.hasProperty = function(name, matcher) { | 751 let rune = input[dartx.runes].single; |
| 877 if (matcher === void 0) matcher = null; | 752 return '\\x' + dart.notNull(rune[dartx.toRadixString](16)[dartx.toUpperCase]
()[dartx.padLeft](2, '0')); |
| 878 return new mirror_matchers._HasProperty(name, matcher == null ? null : src__
util.wrapMatcher(matcher)); | 753 }; |
| 879 }; | 754 dart.fn(src__util._getHexLiteral, StringToString()); |
| 880 dart.fn(mirror_matchers.hasProperty, String__ToMatcher()); | 755 src__operator_matchers.isNot = function(matcher) { |
| 881 const _name$ = Symbol('_name'); | 756 return new src__operator_matchers._IsNot(src__util.wrapMatcher(matcher)); |
| 882 const _matcher$ = Symbol('_matcher'); | 757 }; |
| 883 mirror_matchers._HasProperty = class _HasProperty extends src__interfaces.Matc
her { | 758 dart.fn(src__operator_matchers.isNot, dynamicToMatcher()); |
| 884 new(name, matcher) { | 759 const _matcher$0 = Symbol('_matcher'); |
| 885 if (matcher === void 0) matcher = null; | 760 src__operator_matchers._IsNot = class _IsNot extends src__interfaces.Matcher { |
| 886 this[_name$] = name; | 761 new(matcher) { |
| 887 this[_matcher$] = matcher; | 762 this[_matcher$0] = matcher; |
| 888 super.new(); | 763 super.new(); |
| 889 } | 764 } |
| 890 matches(item, matchState) { | 765 matches(item, matchState) { |
| 891 let mirror = mirrors.reflect(item); | 766 return !dart.test(this[_matcher$0].matches(item, matchState)); |
| 892 let classMirror = mirror.type; | 767 } |
| 893 let symbol = core.Symbol.new(this[_name$]); | 768 describe(description) { |
| 894 let candidate = classMirror.declarations[dartx.get](symbol); | 769 return description.add('not ').addDescriptionOf(this[_matcher$0]); |
| 895 if (candidate == null) { | 770 } |
| 896 src__util.addStateInfo(matchState, dart.map({reason: dart.str`has no pro
perty named "${this[_name$]}"`})); | 771 }; |
| 772 dart.setSignature(src__operator_matchers._IsNot, { |
| 773 constructors: () => ({new: dart.definiteFunctionType(src__operator_matchers.
_IsNot, [src__interfaces.Matcher])}), |
| 774 methods: () => ({ |
| 775 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), |
| 776 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) |
| 777 }) |
| 778 }); |
| 779 src__operator_matchers.allOf = function(arg0, arg1, arg2, arg3, arg4, arg5, ar
g6) { |
| 780 if (arg1 === void 0) arg1 = null; |
| 781 if (arg2 === void 0) arg2 = null; |
| 782 if (arg3 === void 0) arg3 = null; |
| 783 if (arg4 === void 0) arg4 = null; |
| 784 if (arg5 === void 0) arg5 = null; |
| 785 if (arg6 === void 0) arg6 = null; |
| 786 return new src__operator_matchers._AllOf(src__operator_matchers._wrapArgs(ar
g0, arg1, arg2, arg3, arg4, arg5, arg6)); |
| 787 }; |
| 788 dart.fn(src__operator_matchers.allOf, dynamic__ToMatcher()); |
| 789 const _matchers = Symbol('_matchers'); |
| 790 src__operator_matchers._AllOf = class _AllOf extends src__interfaces.Matcher { |
| 791 new(matchers) { |
| 792 this[_matchers] = matchers; |
| 793 super.new(); |
| 794 } |
| 795 matches(item, matchState) { |
| 796 for (let matcher of this[_matchers]) { |
| 797 if (!dart.test(matcher.matches(item, matchState))) { |
| 798 src__util.addStateInfo(matchState, dart.map({matcher: matcher})); |
| 799 return false; |
| 800 } |
| 801 } |
| 802 return true; |
| 803 } |
| 804 describeMismatch(item, mismatchDescription, matchState, verbose) { |
| 805 let matcher = matchState[dartx.get]('matcher'); |
| 806 dart.dsend(matcher, 'describeMismatch', item, mismatchDescription, matchSt
ate[dartx.get]('state'), verbose); |
| 807 return mismatchDescription; |
| 808 } |
| 809 describe(description) { |
| 810 return description.addAll('(', ' and ', ')', this[_matchers]); |
| 811 } |
| 812 }; |
| 813 dart.setSignature(src__operator_matchers._AllOf, { |
| 814 constructors: () => ({new: dart.definiteFunctionType(src__operator_matchers.
_AllOf, [core.List$(src__interfaces.Matcher)])}), |
| 815 methods: () => ({ |
| 816 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), |
| 817 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) |
| 818 }) |
| 819 }); |
| 820 src__operator_matchers.anyOf = function(arg0, arg1, arg2, arg3, arg4, arg5, ar
g6) { |
| 821 if (arg1 === void 0) arg1 = null; |
| 822 if (arg2 === void 0) arg2 = null; |
| 823 if (arg3 === void 0) arg3 = null; |
| 824 if (arg4 === void 0) arg4 = null; |
| 825 if (arg5 === void 0) arg5 = null; |
| 826 if (arg6 === void 0) arg6 = null; |
| 827 return new src__operator_matchers._AnyOf(src__operator_matchers._wrapArgs(ar
g0, arg1, arg2, arg3, arg4, arg5, arg6)); |
| 828 }; |
| 829 dart.fn(src__operator_matchers.anyOf, dynamic__ToMatcher()); |
| 830 src__operator_matchers._AnyOf = class _AnyOf extends src__interfaces.Matcher { |
| 831 new(matchers) { |
| 832 this[_matchers] = matchers; |
| 833 super.new(); |
| 834 } |
| 835 matches(item, matchState) { |
| 836 for (let matcher of this[_matchers]) { |
| 837 if (dart.test(matcher.matches(item, matchState))) { |
| 838 return true; |
| 839 } |
| 840 } |
| 841 return false; |
| 842 } |
| 843 describe(description) { |
| 844 return description.addAll('(', ' or ', ')', this[_matchers]); |
| 845 } |
| 846 }; |
| 847 dart.setSignature(src__operator_matchers._AnyOf, { |
| 848 constructors: () => ({new: dart.definiteFunctionType(src__operator_matchers.
_AnyOf, [core.List$(src__interfaces.Matcher)])}), |
| 849 methods: () => ({ |
| 850 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), |
| 851 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) |
| 852 }) |
| 853 }); |
| 854 src__operator_matchers._wrapArgs = function(arg0, arg1, arg2, arg3, arg4, arg5
, arg6) { |
| 855 let args = null; |
| 856 if (core.List.is(arg0)) { |
| 857 if (arg1 != null || arg2 != null || arg3 != null || arg4 != null || arg5 !
= null || arg6 != null) { |
| 858 dart.throw(new core.ArgumentError('If arg0 is a List, all other argument
s must be' + ' null.')); |
| 859 } |
| 860 args = arg0; |
| 861 } else { |
| 862 args = [arg0, arg1, arg2, arg3, arg4, arg5, arg6][dartx.where](dart.fn(e =
> e != null, dynamicTobool$())); |
| 863 } |
| 864 return args[dartx.map](src__interfaces.Matcher)(dart.fn(e => src__util.wrapM
atcher(e), dynamicToMatcher()))[dartx.toList](); |
| 865 }; |
| 866 dart.fn(src__operator_matchers._wrapArgs, dynamicAnddynamicAnddynamic__ToListO
fMatcher()); |
| 867 src__interfaces.Description = class Description extends core.Object {}; |
| 868 src__string_matchers.equalsIgnoringCase = function(value) { |
| 869 return new src__string_matchers._IsEqualIgnoringCase(value); |
| 870 }; |
| 871 dart.fn(src__string_matchers.equalsIgnoringCase, StringToMatcher()); |
| 872 const _value$ = Symbol('_value'); |
| 873 const _matchValue = Symbol('_matchValue'); |
| 874 src__string_matchers._StringMatcher = class _StringMatcher extends src__interf
aces.Matcher { |
| 875 new() { |
| 876 super.new(); |
| 877 } |
| 878 describeMismatch(item, mismatchDescription, matchState, verbose) { |
| 879 if (!(typeof item == 'string')) { |
| 880 return mismatchDescription.addDescriptionOf(item).add(' not a string'); |
| 881 } else { |
| 882 return super.describeMismatch(item, mismatchDescription, matchState, ver
bose); |
| 883 } |
| 884 } |
| 885 }; |
| 886 dart.setSignature(src__string_matchers._StringMatcher, { |
| 887 constructors: () => ({new: dart.definiteFunctionType(src__string_matchers._S
tringMatcher, [])}) |
| 888 }); |
| 889 src__string_matchers._IsEqualIgnoringCase = class _IsEqualIgnoringCase extends
src__string_matchers._StringMatcher { |
| 890 new(value) { |
| 891 this[_value$] = value; |
| 892 this[_matchValue] = value[dartx.toLowerCase](); |
| 893 super.new(); |
| 894 } |
| 895 matches(item, matchState) { |
| 896 return typeof item == 'string' && this[_matchValue] == item[dartx.toLowerC
ase](); |
| 897 } |
| 898 describe(description) { |
| 899 return description.addDescriptionOf(this[_value$]).add(' ignoring case'); |
| 900 } |
| 901 }; |
| 902 dart.setSignature(src__string_matchers._IsEqualIgnoringCase, { |
| 903 constructors: () => ({new: dart.definiteFunctionType(src__string_matchers._I
sEqualIgnoringCase, [core.String])}), |
| 904 methods: () => ({ |
| 905 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), |
| 906 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) |
| 907 }) |
| 908 }); |
| 909 src__string_matchers.equalsIgnoringWhitespace = function(value) { |
| 910 return new src__string_matchers._IsEqualIgnoringWhitespace(value); |
| 911 }; |
| 912 dart.fn(src__string_matchers.equalsIgnoringWhitespace, StringToMatcher()); |
| 913 src__string_matchers._IsEqualIgnoringWhitespace = class _IsEqualIgnoringWhites
pace extends src__string_matchers._StringMatcher { |
| 914 new(value) { |
| 915 this[_value$] = value; |
| 916 this[_matchValue] = src__string_matchers.collapseWhitespace(value); |
| 917 super.new(); |
| 918 } |
| 919 matches(item, matchState) { |
| 920 return typeof item == 'string' && this[_matchValue] == src__string_matcher
s.collapseWhitespace(item); |
| 921 } |
| 922 describe(description) { |
| 923 return description.addDescriptionOf(this[_matchValue]).add(' ignoring whit
espace'); |
| 924 } |
| 925 describeMismatch(item, mismatchDescription, matchState, verbose) { |
| 926 if (typeof item == 'string') { |
| 927 return mismatchDescription.add('is ').addDescriptionOf(src__string_match
ers.collapseWhitespace(item)).add(' with whitespace compressed'); |
| 928 } else { |
| 929 return super.describeMismatch(item, mismatchDescription, matchState, ver
bose); |
| 930 } |
| 931 } |
| 932 }; |
| 933 dart.setSignature(src__string_matchers._IsEqualIgnoringWhitespace, { |
| 934 constructors: () => ({new: dart.definiteFunctionType(src__string_matchers._I
sEqualIgnoringWhitespace, [core.String])}), |
| 935 methods: () => ({ |
| 936 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), |
| 937 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) |
| 938 }) |
| 939 }); |
| 940 src__string_matchers.startsWith = function(prefixString) { |
| 941 return new src__string_matchers._StringStartsWith(prefixString); |
| 942 }; |
| 943 dart.fn(src__string_matchers.startsWith, StringToMatcher()); |
| 944 const _prefix = Symbol('_prefix'); |
| 945 src__string_matchers._StringStartsWith = class _StringStartsWith extends src__
string_matchers._StringMatcher { |
| 946 new(prefix) { |
| 947 this[_prefix] = prefix; |
| 948 super.new(); |
| 949 } |
| 950 matches(item, matchState) { |
| 951 return typeof item == 'string' && dart.test(item[dartx.startsWith](this[_p
refix])); |
| 952 } |
| 953 describe(description) { |
| 954 return description.add('a string starting with ').addDescriptionOf(this[_p
refix]); |
| 955 } |
| 956 }; |
| 957 dart.setSignature(src__string_matchers._StringStartsWith, { |
| 958 constructors: () => ({new: dart.definiteFunctionType(src__string_matchers._S
tringStartsWith, [core.String])}), |
| 959 methods: () => ({ |
| 960 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), |
| 961 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) |
| 962 }) |
| 963 }); |
| 964 src__string_matchers.endsWith = function(suffixString) { |
| 965 return new src__string_matchers._StringEndsWith(suffixString); |
| 966 }; |
| 967 dart.fn(src__string_matchers.endsWith, StringToMatcher()); |
| 968 const _suffix = Symbol('_suffix'); |
| 969 src__string_matchers._StringEndsWith = class _StringEndsWith extends src__stri
ng_matchers._StringMatcher { |
| 970 new(suffix) { |
| 971 this[_suffix] = suffix; |
| 972 super.new(); |
| 973 } |
| 974 matches(item, matchState) { |
| 975 return typeof item == 'string' && dart.test(item[dartx.endsWith](this[_suf
fix])); |
| 976 } |
| 977 describe(description) { |
| 978 return description.add('a string ending with ').addDescriptionOf(this[_suf
fix]); |
| 979 } |
| 980 }; |
| 981 dart.setSignature(src__string_matchers._StringEndsWith, { |
| 982 constructors: () => ({new: dart.definiteFunctionType(src__string_matchers._S
tringEndsWith, [core.String])}), |
| 983 methods: () => ({ |
| 984 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), |
| 985 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) |
| 986 }) |
| 987 }); |
| 988 src__string_matchers.stringContainsInOrder = function(substrings) { |
| 989 return new src__string_matchers._StringContainsInOrder(substrings); |
| 990 }; |
| 991 dart.fn(src__string_matchers.stringContainsInOrder, ListOfStringToMatcher()); |
| 992 const _substrings = Symbol('_substrings'); |
| 993 src__string_matchers._StringContainsInOrder = class _StringContainsInOrder ext
ends src__string_matchers._StringMatcher { |
| 994 new(substrings) { |
| 995 this[_substrings] = substrings; |
| 996 super.new(); |
| 997 } |
| 998 matches(item, matchState) { |
| 999 if (!(typeof item == 'string')) { |
| 897 return false; | 1000 return false; |
| 898 } | 1001 } |
| 899 let isInstanceField = mirrors.VariableMirror.is(candidate) && !dart.test(c
andidate.isStatic); | 1002 let from_index = 0; |
| 900 let isInstanceGetter = mirrors.MethodMirror.is(candidate) && dart.test(can
didate.isGetter) && !dart.test(candidate.isStatic); | 1003 for (let s of this[_substrings]) { |
| 901 if (!(isInstanceField || isInstanceGetter)) { | 1004 from_index = core.int._check(dart.dsend(item, 'indexOf', s, from_index))
; |
| 902 src__util.addStateInfo(matchState, dart.map({reason: dart.str`has a memb
er named "${this[_name$]}", but it is not an instance property`})); | 1005 if (dart.notNull(from_index) < 0) return false; |
| 903 return false; | 1006 } |
| 904 } | 1007 return true; |
| 905 if (this[_matcher$] == null) return true; | 1008 } |
| 906 let result = mirror.getField(symbol); | 1009 describe(description) { |
| 907 let resultMatches = this[_matcher$].matches(result.reflectee, matchState); | 1010 return description.addAll('a string containing ', ', ', ' in order', this[
_substrings]); |
| 908 if (!dart.test(resultMatches)) { | 1011 } |
| 909 src__util.addStateInfo(matchState, dart.map({value: result.reflectee})); | 1012 }; |
| 910 } | 1013 dart.setSignature(src__string_matchers._StringContainsInOrder, { |
| 911 return resultMatches; | 1014 constructors: () => ({new: dart.definiteFunctionType(src__string_matchers._S
tringContainsInOrder, [core.List$(core.String)])}), |
| 912 } | 1015 methods: () => ({ |
| 913 describe(description) { | 1016 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), |
| 914 description.add(dart.str`has property "${this[_name$]}"`); | 1017 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) |
| 915 if (this[_matcher$] != null) { | 1018 }) |
| 916 description.add(' which matches ').addDescriptionOf(this[_matcher$]); | 1019 }); |
| 917 } | 1020 src__string_matchers.matches = function(re) { |
| 918 return description; | 1021 return new src__string_matchers._MatchesRegExp(re); |
| 919 } | 1022 }; |
| 920 describeMismatch(item, mismatchDescription, matchState, verbose) { | 1023 dart.fn(src__string_matchers.matches, dynamicToMatcher()); |
| 921 let reason = matchState == null ? null : matchState[dartx.get]('reason'); | 1024 const _regexp = Symbol('_regexp'); |
| 922 if (reason != null) { | 1025 src__string_matchers._MatchesRegExp = class _MatchesRegExp extends src__string
_matchers._StringMatcher { |
| 923 mismatchDescription.add(core.String._check(reason)); | 1026 new(re) { |
| 924 } else { | 1027 this[_regexp] = null; |
| 925 mismatchDescription.add(dart.str`has property "${this[_name$]}" with val
ue `).addDescriptionOf(matchState[dartx.get]('value')); | 1028 super.new(); |
| 926 let innerDescription = new src__description.StringDescription(); | 1029 if (typeof re == 'string') { |
| 927 this[_matcher$].describeMismatch(matchState[dartx.get]('value'), innerDe
scription, core.Map._check(matchState[dartx.get]('state')), verbose); | 1030 this[_regexp] = core.RegExp.new(re); |
| 928 if (dart.notNull(innerDescription.length) > 0) { | 1031 } else if (core.RegExp.is(re)) { |
| 929 mismatchDescription.add(' which ').add(innerDescription.toString()); | 1032 this[_regexp] = re; |
| 1033 } else { |
| 1034 dart.throw(new core.ArgumentError('matches requires a regexp or string')
); |
| 1035 } |
| 1036 } |
| 1037 matches(item, matchState) { |
| 1038 return typeof item == 'string' ? this[_regexp].hasMatch(item) : false; |
| 1039 } |
| 1040 describe(description) { |
| 1041 return description.add(dart.str`match '${this[_regexp].pattern}'`); |
| 1042 } |
| 1043 }; |
| 1044 dart.setSignature(src__string_matchers._MatchesRegExp, { |
| 1045 constructors: () => ({new: dart.definiteFunctionType(src__string_matchers._M
atchesRegExp, [dart.dynamic])}), |
| 1046 methods: () => ({ |
| 1047 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), |
| 1048 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) |
| 1049 }) |
| 1050 }); |
| 1051 src__string_matchers.collapseWhitespace = function(string) { |
| 1052 let result = new core.StringBuffer(); |
| 1053 let skipSpace = true; |
| 1054 for (let i = 0; i < dart.notNull(string[dartx.length]); i++) { |
| 1055 let character = string[dartx.get](i); |
| 1056 if (dart.test(src__string_matchers._isWhitespace(character))) { |
| 1057 if (!skipSpace) { |
| 1058 result.write(' '); |
| 1059 skipSpace = true; |
| 930 } | 1060 } |
| 931 } | 1061 } else { |
| 932 return mismatchDescription; | 1062 result.write(character); |
| 933 } | 1063 skipSpace = false; |
| 934 }; | 1064 } |
| 935 dart.setSignature(mirror_matchers._HasProperty, { | 1065 } |
| 936 constructors: () => ({new: dart.definiteFunctionType(mirror_matchers._HasPro
perty, [core.String], [src__interfaces.Matcher])}), | 1066 return result.toString()[dartx.trim](); |
| 937 methods: () => ({ | 1067 }; |
| 938 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), | 1068 dart.fn(src__string_matchers.collapseWhitespace, StringToString()); |
| 939 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) | 1069 src__string_matchers._isWhitespace = function(ch) { |
| 940 }) | 1070 return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t'; |
| 941 }); | 1071 }; |
| 942 const _expected = Symbol('_expected'); | 1072 dart.fn(src__string_matchers._isWhitespace, StringTobool()); |
| 1073 src__core_matchers._Empty = class _Empty extends src__interfaces.Matcher { |
| 1074 new() { |
| 1075 super.new(); |
| 1076 } |
| 1077 matches(item, matchState) { |
| 1078 return core.bool._check(dart.dload(item, 'isEmpty')); |
| 1079 } |
| 1080 describe(description) { |
| 1081 return description.add('empty'); |
| 1082 } |
| 1083 }; |
| 1084 dart.setSignature(src__core_matchers._Empty, { |
| 1085 constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._Emp
ty, [])}), |
| 1086 methods: () => ({ |
| 1087 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), |
| 1088 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) |
| 1089 }) |
| 1090 }); |
| 1091 src__core_matchers.isEmpty = dart.const(new src__core_matchers._Empty()); |
| 1092 src__core_matchers._NotEmpty = class _NotEmpty extends src__interfaces.Matcher
{ |
| 1093 new() { |
| 1094 super.new(); |
| 1095 } |
| 1096 matches(item, matchState) { |
| 1097 return core.bool._check(dart.dload(item, 'isNotEmpty')); |
| 1098 } |
| 1099 describe(description) { |
| 1100 return description.add('non-empty'); |
| 1101 } |
| 1102 }; |
| 1103 dart.setSignature(src__core_matchers._NotEmpty, { |
| 1104 constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._Not
Empty, [])}), |
| 1105 methods: () => ({ |
| 1106 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), |
| 1107 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) |
| 1108 }) |
| 1109 }); |
| 1110 src__core_matchers.isNotEmpty = dart.const(new src__core_matchers._NotEmpty())
; |
| 1111 src__core_matchers._IsNull = class _IsNull extends src__interfaces.Matcher { |
| 1112 new() { |
| 1113 super.new(); |
| 1114 } |
| 1115 matches(item, matchState) { |
| 1116 return item == null; |
| 1117 } |
| 1118 describe(description) { |
| 1119 return description.add('null'); |
| 1120 } |
| 1121 }; |
| 1122 dart.setSignature(src__core_matchers._IsNull, { |
| 1123 constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._IsN
ull, [])}), |
| 1124 methods: () => ({ |
| 1125 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), |
| 1126 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) |
| 1127 }) |
| 1128 }); |
| 1129 src__core_matchers.isNull = dart.const(new src__core_matchers._IsNull()); |
| 1130 src__core_matchers._IsNotNull = class _IsNotNull extends src__interfaces.Match
er { |
| 1131 new() { |
| 1132 super.new(); |
| 1133 } |
| 1134 matches(item, matchState) { |
| 1135 return item != null; |
| 1136 } |
| 1137 describe(description) { |
| 1138 return description.add('not null'); |
| 1139 } |
| 1140 }; |
| 1141 dart.setSignature(src__core_matchers._IsNotNull, { |
| 1142 constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._IsN
otNull, [])}), |
| 1143 methods: () => ({ |
| 1144 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), |
| 1145 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) |
| 1146 }) |
| 1147 }); |
| 1148 src__core_matchers.isNotNull = dart.const(new src__core_matchers._IsNotNull())
; |
| 1149 src__core_matchers._IsTrue = class _IsTrue extends src__interfaces.Matcher { |
| 1150 new() { |
| 1151 super.new(); |
| 1152 } |
| 1153 matches(item, matchState) { |
| 1154 return dart.equals(item, true); |
| 1155 } |
| 1156 describe(description) { |
| 1157 return description.add('true'); |
| 1158 } |
| 1159 }; |
| 1160 dart.setSignature(src__core_matchers._IsTrue, { |
| 1161 constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._IsT
rue, [])}), |
| 1162 methods: () => ({ |
| 1163 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), |
| 1164 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) |
| 1165 }) |
| 1166 }); |
| 1167 src__core_matchers.isTrue = dart.const(new src__core_matchers._IsTrue()); |
| 1168 src__core_matchers._IsFalse = class _IsFalse extends src__interfaces.Matcher { |
| 1169 new() { |
| 1170 super.new(); |
| 1171 } |
| 1172 matches(item, matchState) { |
| 1173 return dart.equals(item, false); |
| 1174 } |
| 1175 describe(description) { |
| 1176 return description.add('false'); |
| 1177 } |
| 1178 }; |
| 1179 dart.setSignature(src__core_matchers._IsFalse, { |
| 1180 constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._IsF
alse, [])}), |
| 1181 methods: () => ({ |
| 1182 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), |
| 1183 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) |
| 1184 }) |
| 1185 }); |
| 1186 src__core_matchers.isFalse = dart.const(new src__core_matchers._IsFalse()); |
| 1187 src__core_matchers._IsNaN = class _IsNaN extends src__interfaces.Matcher { |
| 1188 new() { |
| 1189 super.new(); |
| 1190 } |
| 1191 matches(item, matchState) { |
| 1192 return core.double.NAN[dartx.compareTo](core.num._check(item)) == 0; |
| 1193 } |
| 1194 describe(description) { |
| 1195 return description.add('NaN'); |
| 1196 } |
| 1197 }; |
| 1198 dart.setSignature(src__core_matchers._IsNaN, { |
| 1199 constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._IsN
aN, [])}), |
| 1200 methods: () => ({ |
| 1201 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), |
| 1202 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) |
| 1203 }) |
| 1204 }); |
| 1205 src__core_matchers.isNaN = dart.const(new src__core_matchers._IsNaN()); |
| 1206 src__core_matchers._IsNotNaN = class _IsNotNaN extends src__interfaces.Matcher
{ |
| 1207 new() { |
| 1208 super.new(); |
| 1209 } |
| 1210 matches(item, matchState) { |
| 1211 return core.double.NAN[dartx.compareTo](core.num._check(item)) != 0; |
| 1212 } |
| 1213 describe(description) { |
| 1214 return description.add('not NaN'); |
| 1215 } |
| 1216 }; |
| 1217 dart.setSignature(src__core_matchers._IsNotNaN, { |
| 1218 constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._IsN
otNaN, [])}), |
| 1219 methods: () => ({ |
| 1220 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), |
| 1221 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) |
| 1222 }) |
| 1223 }); |
| 1224 src__core_matchers.isNotNaN = dart.const(new src__core_matchers._IsNotNaN()); |
| 1225 src__core_matchers.same = function(expected) { |
| 1226 return new src__core_matchers._IsSameAs(expected); |
| 1227 }; |
| 1228 dart.fn(src__core_matchers.same, dynamicToMatcher()); |
| 1229 const _expected$ = Symbol('_expected'); |
| 943 src__core_matchers._IsSameAs = class _IsSameAs extends src__interfaces.Matcher
{ | 1230 src__core_matchers._IsSameAs = class _IsSameAs extends src__interfaces.Matcher
{ |
| 944 new(expected) { | 1231 new(expected) { |
| 945 this[_expected] = expected; | 1232 this[_expected$] = expected; |
| 946 super.new(); | 1233 super.new(); |
| 947 } | 1234 } |
| 948 matches(item, matchState) { | 1235 matches(item, matchState) { |
| 949 return core.identical(item, this[_expected]); | 1236 return core.identical(item, this[_expected$]); |
| 950 } | 1237 } |
| 951 describe(description) { | 1238 describe(description) { |
| 952 return description.add('same instance as ').addDescriptionOf(this[_expecte
d]); | 1239 return description.add('same instance as ').addDescriptionOf(this[_expecte
d$]); |
| 953 } | 1240 } |
| 954 }; | 1241 }; |
| 955 dart.setSignature(src__core_matchers._IsSameAs, { | 1242 dart.setSignature(src__core_matchers._IsSameAs, { |
| 956 constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._IsS
ameAs, [dart.dynamic])}), | 1243 constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._IsS
ameAs, [dart.dynamic])}), |
| 957 methods: () => ({ | 1244 methods: () => ({ |
| 958 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), | 1245 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), |
| 959 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) | 1246 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) |
| 960 }) | 1247 }) |
| 961 }); | 1248 }); |
| 1249 src__core_matchers.equals = function(expected, limit) { |
| 1250 if (limit === void 0) limit = 100; |
| 1251 return typeof expected == 'string' ? new src__core_matchers._StringEqualsMat
cher(expected) : new src__core_matchers._DeepMatcher(expected, limit); |
| 1252 }; |
| 1253 dart.fn(src__core_matchers.equals, dynamic__ToMatcher$()); |
| 962 const _limit = Symbol('_limit'); | 1254 const _limit = Symbol('_limit'); |
| 963 const _compareIterables = Symbol('_compareIterables'); | 1255 const _compareIterables = Symbol('_compareIterables'); |
| 964 const _compareSets = Symbol('_compareSets'); | 1256 const _compareSets = Symbol('_compareSets'); |
| 965 const _recursiveMatch = Symbol('_recursiveMatch'); | 1257 const _recursiveMatch = Symbol('_recursiveMatch'); |
| 966 const _match = Symbol('_match'); | 1258 const _match = Symbol('_match'); |
| 967 src__core_matchers._DeepMatcher = class _DeepMatcher extends src__interfaces.M
atcher { | 1259 src__core_matchers._DeepMatcher = class _DeepMatcher extends src__interfaces.M
atcher { |
| 968 new(expected, limit) { | 1260 new(expected, limit) { |
| 969 if (limit === void 0) limit = 1000; | 1261 if (limit === void 0) limit = 1000; |
| 970 this[_expected] = expected; | 1262 this[_expected$] = expected; |
| 971 this[_limit] = limit; | 1263 this[_limit] = limit; |
| 972 this.count = null; | 1264 this.count = null; |
| 973 super.new(); | 1265 super.new(); |
| 974 } | 1266 } |
| 975 [_compareIterables](expected, actual, matcher, depth, location) { | 1267 [_compareIterables](expected, actual, matcher, depth, location) { |
| 976 if (!core.Iterable.is(actual)) return ['is not Iterable', location]; | 1268 if (!core.Iterable.is(actual)) return ['is not Iterable', location]; |
| 977 let expectedIterator = dart.dload(expected, 'iterator'); | 1269 let expectedIterator = dart.dload(expected, 'iterator'); |
| 978 let actualIterator = dart.dload(actual, 'iterator'); | 1270 let actualIterator = dart.dload(actual, 'iterator'); |
| 979 for (let index = 0;; index++) { | 1271 for (let index = 0;; index++) { |
| 980 let expectedNext = dart.dsend(expectedIterator, 'moveNext'); | 1272 let expectedNext = dart.dsend(expectedIterator, 'moveNext'); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1061 } else { | 1353 } else { |
| 1062 reason = rp[dartx.get](0); | 1354 reason = rp[dartx.get](0); |
| 1063 } | 1355 } |
| 1064 } else { | 1356 } else { |
| 1065 reason = ''; | 1357 reason = ''; |
| 1066 } | 1358 } |
| 1067 src__util.addStateInfo(matchState, dart.map({reason: reason})); | 1359 src__util.addStateInfo(matchState, dart.map({reason: reason})); |
| 1068 return core.String._check(reason); | 1360 return core.String._check(reason); |
| 1069 } | 1361 } |
| 1070 matches(item, matchState) { | 1362 matches(item, matchState) { |
| 1071 return this[_match](this[_expected], item, matchState) == null; | 1363 return this[_match](this[_expected$], item, matchState) == null; |
| 1072 } | 1364 } |
| 1073 describe(description) { | 1365 describe(description) { |
| 1074 return description.addDescriptionOf(this[_expected]); | 1366 return description.addDescriptionOf(this[_expected$]); |
| 1075 } | 1367 } |
| 1076 describeMismatch(item, mismatchDescription, matchState, verbose) { | 1368 describeMismatch(item, mismatchDescription, matchState, verbose) { |
| 1077 let reason = matchState[dartx.get]('reason'); | 1369 let reason = matchState[dartx.get]('reason'); |
| 1078 if (dart.equals(dart.dload(reason, 'length'), 0) && dart.notNull(mismatchD
escription.length) > 0) { | 1370 if (dart.equals(dart.dload(reason, 'length'), 0) && dart.notNull(mismatchD
escription.length) > 0) { |
| 1079 mismatchDescription.add('is ').addDescriptionOf(item); | 1371 mismatchDescription.add('is ').addDescriptionOf(item); |
| 1080 } else { | 1372 } else { |
| 1081 mismatchDescription.add(core.String._check(reason)); | 1373 mismatchDescription.add(core.String._check(reason)); |
| 1082 } | 1374 } |
| 1083 return mismatchDescription; | 1375 return mismatchDescription; |
| 1084 } | 1376 } |
| 1085 }; | 1377 }; |
| 1086 dart.setSignature(src__core_matchers._DeepMatcher, { | 1378 dart.setSignature(src__core_matchers._DeepMatcher, { |
| 1087 constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._Dee
pMatcher, [dart.dynamic], [core.int])}), | 1379 constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._Dee
pMatcher, [dart.dynamic], [core.int])}), |
| 1088 methods: () => ({ | 1380 methods: () => ({ |
| 1089 [_compareIterables]: dart.definiteFunctionType(core.List, [dart.dynamic, d
art.dynamic, dart.dynamic, dart.dynamic, dart.dynamic]), | 1381 [_compareIterables]: dart.definiteFunctionType(core.List, [dart.dynamic, d
art.dynamic, dart.dynamic, dart.dynamic, dart.dynamic]), |
| 1090 [_compareSets]: dart.definiteFunctionType(core.List, [core.Set, dart.dynam
ic, dart.dynamic, dart.dynamic, dart.dynamic]), | 1382 [_compareSets]: dart.definiteFunctionType(core.List, [core.Set, dart.dynam
ic, dart.dynamic, dart.dynamic, dart.dynamic]), |
| 1091 [_recursiveMatch]: dart.definiteFunctionType(core.List, [dart.dynamic, dar
t.dynamic, core.String, core.int]), | 1383 [_recursiveMatch]: dart.definiteFunctionType(core.List, [dart.dynamic, dar
t.dynamic, core.String, core.int]), |
| 1092 [_match]: dart.definiteFunctionType(core.String, [dart.dynamic, dart.dynam
ic, core.Map]), | 1384 [_match]: dart.definiteFunctionType(core.String, [dart.dynamic, dart.dynam
ic, core.Map]), |
| 1093 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), | 1385 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), |
| 1094 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) | 1386 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) |
| 1095 }) | 1387 }) |
| 1096 }); | 1388 }); |
| 1097 const _value$ = Symbol('_value'); | 1389 const _value$0 = Symbol('_value'); |
| 1098 src__core_matchers._StringEqualsMatcher = class _StringEqualsMatcher extends s
rc__interfaces.Matcher { | 1390 src__core_matchers._StringEqualsMatcher = class _StringEqualsMatcher extends s
rc__interfaces.Matcher { |
| 1099 new(value) { | 1391 new(value) { |
| 1100 this[_value$] = value; | 1392 this[_value$0] = value; |
| 1101 super.new(); | 1393 super.new(); |
| 1102 } | 1394 } |
| 1103 get showActualValue() { | 1395 get showActualValue() { |
| 1104 return true; | 1396 return true; |
| 1105 } | 1397 } |
| 1106 matches(item, matchState) { | 1398 matches(item, matchState) { |
| 1107 return dart.equals(this[_value$], item); | 1399 return dart.equals(this[_value$0], item); |
| 1108 } | 1400 } |
| 1109 describe(description) { | 1401 describe(description) { |
| 1110 return description.addDescriptionOf(this[_value$]); | 1402 return description.addDescriptionOf(this[_value$0]); |
| 1111 } | 1403 } |
| 1112 describeMismatch(item, mismatchDescription, matchState, verbose) { | 1404 describeMismatch(item, mismatchDescription, matchState, verbose) { |
| 1113 if (!(typeof item == 'string')) { | 1405 if (!(typeof item == 'string')) { |
| 1114 return mismatchDescription.addDescriptionOf(item).add('is not a string')
; | 1406 return mismatchDescription.addDescriptionOf(item).add('is not a string')
; |
| 1115 } else { | 1407 } else { |
| 1116 let buff = new core.StringBuffer(); | 1408 let buff = new core.StringBuffer(); |
| 1117 buff.write('is different.'); | 1409 buff.write('is different.'); |
| 1118 let escapedItem = src__util.escape(core.String._check(item)); | 1410 let escapedItem = src__util.escape(core.String._check(item)); |
| 1119 let escapedValue = src__util.escape(this[_value$]); | 1411 let escapedValue = src__util.escape(this[_value$0]); |
| 1120 let minLength = dart.notNull(escapedItem[dartx.length]) < dart.notNull(e
scapedValue[dartx.length]) ? escapedItem[dartx.length] : escapedValue[dartx.leng
th]; | 1412 let minLength = dart.notNull(escapedItem[dartx.length]) < dart.notNull(e
scapedValue[dartx.length]) ? escapedItem[dartx.length] : escapedValue[dartx.leng
th]; |
| 1121 let start = 0; | 1413 let start = 0; |
| 1122 for (; start < dart.notNull(minLength); start++) { | 1414 for (; start < dart.notNull(minLength); start++) { |
| 1123 if (escapedValue[dartx.codeUnitAt](start) != escapedItem[dartx.codeUni
tAt](start)) { | 1415 if (escapedValue[dartx.codeUnitAt](start) != escapedItem[dartx.codeUni
tAt](start)) { |
| 1124 break; | 1416 break; |
| 1125 } | 1417 } |
| 1126 } | 1418 } |
| 1127 if (start == minLength) { | 1419 if (start == minLength) { |
| 1128 if (dart.notNull(escapedValue[dartx.length]) < dart.notNull(escapedIte
m[dartx.length])) { | 1420 if (dart.notNull(escapedValue[dartx.length]) < dart.notNull(escapedIte
m[dartx.length])) { |
| 1129 buff.write(' Both strings start the same, but the given value also'
+ ' has the following trailing characters: '); | 1421 buff.write(' Both strings start the same, but the given value also'
+ ' has the following trailing characters: '); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1169 methods: () => ({ | 1461 methods: () => ({ |
| 1170 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), | 1462 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), |
| 1171 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) | 1463 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) |
| 1172 }), | 1464 }), |
| 1173 statics: () => ({ | 1465 statics: () => ({ |
| 1174 _writeLeading: dart.definiteFunctionType(dart.void, [core.StringBuffer, co
re.String, core.int]), | 1466 _writeLeading: dart.definiteFunctionType(dart.void, [core.StringBuffer, co
re.String, core.int]), |
| 1175 _writeTrailing: dart.definiteFunctionType(dart.void, [core.StringBuffer, c
ore.String, core.int]) | 1467 _writeTrailing: dart.definiteFunctionType(dart.void, [core.StringBuffer, c
ore.String, core.int]) |
| 1176 }), | 1468 }), |
| 1177 names: ['_writeLeading', '_writeTrailing'] | 1469 names: ['_writeLeading', '_writeTrailing'] |
| 1178 }); | 1470 }); |
| 1471 src__core_matchers._IsAnything = class _IsAnything extends src__interfaces.Mat
cher { |
| 1472 new() { |
| 1473 super.new(); |
| 1474 } |
| 1475 matches(item, matchState) { |
| 1476 return true; |
| 1477 } |
| 1478 describe(description) { |
| 1479 return description.add('anything'); |
| 1480 } |
| 1481 }; |
| 1482 dart.setSignature(src__core_matchers._IsAnything, { |
| 1483 constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._IsA
nything, [])}), |
| 1484 methods: () => ({ |
| 1485 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), |
| 1486 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) |
| 1487 }) |
| 1488 }); |
| 1489 src__core_matchers.anything = dart.const(new src__core_matchers._IsAnything())
; |
| 1490 src__core_matchers.isInstanceOf$ = dart.generic(T => { |
| 1491 class isInstanceOf extends src__interfaces.Matcher { |
| 1492 new() { |
| 1493 super.new(); |
| 1494 } |
| 1495 matches(obj, matchState) { |
| 1496 return T.is(obj); |
| 1497 } |
| 1498 describe(description) { |
| 1499 return description.add(dart.str`an instance of ${dart.wrapType(T)}`); |
| 1500 } |
| 1501 } |
| 1502 dart.addTypeTests(isInstanceOf); |
| 1503 dart.setSignature(isInstanceOf, { |
| 1504 constructors: () => ({new: dart.definiteFunctionType(src__core_matchers.is
InstanceOf$(T), [])}), |
| 1505 methods: () => ({ |
| 1506 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), |
| 1507 describe: dart.definiteFunctionType(src__interfaces.Description, [src__i
nterfaces.Description]) |
| 1508 }) |
| 1509 }); |
| 1510 return isInstanceOf; |
| 1511 }); |
| 1512 src__core_matchers.isInstanceOf = isInstanceOf(); |
| 1513 src__core_matchers._ReturnsNormally = class _ReturnsNormally extends src__inte
rfaces.Matcher { |
| 1514 new() { |
| 1515 super.new(); |
| 1516 } |
| 1517 matches(f, matchState) { |
| 1518 try { |
| 1519 dart.dcall(f); |
| 1520 return true; |
| 1521 } catch (e) { |
| 1522 let s = dart.stackTrace(e); |
| 1523 src__util.addStateInfo(matchState, dart.map({exception: e, stack: s})); |
| 1524 return false; |
| 1525 } |
| 1526 |
| 1527 } |
| 1528 describe(description) { |
| 1529 return description.add("return normally"); |
| 1530 } |
| 1531 describeMismatch(item, mismatchDescription, matchState, verbose) { |
| 1532 mismatchDescription.add('threw ').addDescriptionOf(matchState[dartx.get]('
exception')); |
| 1533 if (dart.test(verbose)) { |
| 1534 mismatchDescription.add(' at ').add(dart.toString(matchState[dartx.get](
'stack'))); |
| 1535 } |
| 1536 return mismatchDescription; |
| 1537 } |
| 1538 }; |
| 1539 dart.setSignature(src__core_matchers._ReturnsNormally, { |
| 1540 constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._Ret
urnsNormally, [])}), |
| 1541 methods: () => ({ |
| 1542 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), |
| 1543 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) |
| 1544 }) |
| 1545 }); |
| 1546 src__core_matchers.returnsNormally = dart.const(new src__core_matchers._Return
sNormally()); |
| 1547 src__core_matchers._IsMap = class _IsMap extends src__core_matchers.TypeMatche
r { |
| 1548 new() { |
| 1549 super.new("Map"); |
| 1550 } |
| 1551 matches(item, matchState) { |
| 1552 return core.Map.is(item); |
| 1553 } |
| 1554 }; |
| 1555 dart.setSignature(src__core_matchers._IsMap, { |
| 1556 constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._IsM
ap, [])}), |
| 1557 methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic
, core.Map])}) |
| 1558 }); |
| 1559 src__core_matchers.isMap = dart.const(new src__core_matchers._IsMap()); |
| 1560 src__core_matchers._IsList = class _IsList extends src__core_matchers.TypeMatc
her { |
| 1561 new() { |
| 1562 super.new("List"); |
| 1563 } |
| 1564 matches(item, matchState) { |
| 1565 return core.List.is(item); |
| 1566 } |
| 1567 }; |
| 1568 dart.setSignature(src__core_matchers._IsList, { |
| 1569 constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._IsL
ist, [])}), |
| 1570 methods: () => ({matches: dart.definiteFunctionType(core.bool, [dart.dynamic
, core.Map])}) |
| 1571 }); |
| 1572 src__core_matchers.isList = dart.const(new src__core_matchers._IsList()); |
| 1573 src__core_matchers.hasLength = function(matcher) { |
| 1574 return new src__core_matchers._HasLength(src__util.wrapMatcher(matcher)); |
| 1575 }; |
| 1576 dart.fn(src__core_matchers.hasLength, dynamicToMatcher()); |
| 1577 const _matcher$1 = Symbol('_matcher'); |
| 1179 src__core_matchers._HasLength = class _HasLength extends src__interfaces.Match
er { | 1578 src__core_matchers._HasLength = class _HasLength extends src__interfaces.Match
er { |
| 1180 new(matcher) { | 1579 new(matcher) { |
| 1181 if (matcher === void 0) matcher = null; | 1580 if (matcher === void 0) matcher = null; |
| 1182 this[_matcher] = matcher; | 1581 this[_matcher$1] = matcher; |
| 1183 super.new(); | 1582 super.new(); |
| 1184 } | 1583 } |
| 1185 matches(item, matchState) { | 1584 matches(item, matchState) { |
| 1186 try { | 1585 try { |
| 1187 if (dart.test(dart.dsend(dart.dsend(dart.dload(item, 'length'), '*', dar
t.dload(item, 'length')), '>=', 0))) { | 1586 if (dart.test(dart.dsend(dart.dsend(dart.dload(item, 'length'), '*', dar
t.dload(item, 'length')), '>=', 0))) { |
| 1188 return this[_matcher].matches(dart.dload(item, 'length'), matchState); | 1587 return this[_matcher$1].matches(dart.dload(item, 'length'), matchState
); |
| 1189 } | 1588 } |
| 1190 } catch (e) { | 1589 } catch (e) { |
| 1191 } | 1590 } |
| 1192 | 1591 |
| 1193 return false; | 1592 return false; |
| 1194 } | 1593 } |
| 1195 describe(description) { | 1594 describe(description) { |
| 1196 return description.add('an object with length of ').addDescriptionOf(this[
_matcher]); | 1595 return description.add('an object with length of ').addDescriptionOf(this[
_matcher$1]); |
| 1197 } | 1596 } |
| 1198 describeMismatch(item, mismatchDescription, matchState, verbose) { | 1597 describeMismatch(item, mismatchDescription, matchState, verbose) { |
| 1199 try { | 1598 try { |
| 1200 if (dart.test(dart.dsend(dart.dsend(dart.dload(item, 'length'), '*', dar
t.dload(item, 'length')), '>=', 0))) { | 1599 if (dart.test(dart.dsend(dart.dsend(dart.dload(item, 'length'), '*', dar
t.dload(item, 'length')), '>=', 0))) { |
| 1201 return mismatchDescription.add('has length of ').addDescriptionOf(dart
.dload(item, 'length')); | 1600 return mismatchDescription.add('has length of ').addDescriptionOf(dart
.dload(item, 'length')); |
| 1202 } | 1601 } |
| 1203 } catch (e) { | 1602 } catch (e) { |
| 1204 } | 1603 } |
| 1205 | 1604 |
| 1206 return mismatchDescription.add('has no length property'); | 1605 return mismatchDescription.add('has no length property'); |
| 1207 } | 1606 } |
| 1208 }; | 1607 }; |
| 1209 dart.setSignature(src__core_matchers._HasLength, { | 1608 dart.setSignature(src__core_matchers._HasLength, { |
| 1210 constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._Has
Length, [], [src__interfaces.Matcher])}), | 1609 constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._Has
Length, [], [src__interfaces.Matcher])}), |
| 1211 methods: () => ({ | 1610 methods: () => ({ |
| 1212 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), | 1611 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), |
| 1213 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) | 1612 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) |
| 1214 }) | 1613 }) |
| 1215 }); | 1614 }); |
| 1615 src__core_matchers.contains = function(expected) { |
| 1616 return new src__core_matchers._Contains(expected); |
| 1617 }; |
| 1618 dart.fn(src__core_matchers.contains, dynamicToMatcher()); |
| 1216 src__core_matchers._Contains = class _Contains extends src__interfaces.Matcher
{ | 1619 src__core_matchers._Contains = class _Contains extends src__interfaces.Matcher
{ |
| 1217 new(expected) { | 1620 new(expected) { |
| 1218 this[_expected] = expected; | 1621 this[_expected$] = expected; |
| 1219 super.new(); | 1622 super.new(); |
| 1220 } | 1623 } |
| 1221 matches(item, matchState) { | 1624 matches(item, matchState) { |
| 1222 if (typeof item == 'string') { | 1625 if (typeof item == 'string') { |
| 1223 return dart.notNull(item[dartx.indexOf](core.Pattern._check(this[_expect
ed]))) >= 0; | 1626 return dart.notNull(item[dartx.indexOf](core.Pattern._check(this[_expect
ed$]))) >= 0; |
| 1224 } else if (core.Iterable.is(item)) { | 1627 } else if (core.Iterable.is(item)) { |
| 1225 if (src__interfaces.Matcher.is(this[_expected])) { | 1628 if (src__interfaces.Matcher.is(this[_expected$])) { |
| 1226 return item[dartx.any](dart.fn(e => core.bool._check(dart.dsend(this[_
expected], 'matches', e, matchState)), dynamicTobool$())); | 1629 return item[dartx.any](dart.fn(e => core.bool._check(dart.dsend(this[_
expected$], 'matches', e, matchState)), dynamicTobool$())); |
| 1227 } else { | 1630 } else { |
| 1228 return item[dartx.contains](this[_expected]); | 1631 return item[dartx.contains](this[_expected$]); |
| 1229 } | 1632 } |
| 1230 } else if (core.Map.is(item)) { | 1633 } else if (core.Map.is(item)) { |
| 1231 return item[dartx.containsKey](this[_expected]); | 1634 return item[dartx.containsKey](this[_expected$]); |
| 1232 } | 1635 } |
| 1233 return false; | 1636 return false; |
| 1234 } | 1637 } |
| 1235 describe(description) { | 1638 describe(description) { |
| 1236 return description.add('contains ').addDescriptionOf(this[_expected]); | 1639 return description.add('contains ').addDescriptionOf(this[_expected$]); |
| 1237 } | 1640 } |
| 1238 describeMismatch(item, mismatchDescription, matchState, verbose) { | 1641 describeMismatch(item, mismatchDescription, matchState, verbose) { |
| 1239 if (typeof item == 'string' || core.Iterable.is(item) || core.Map.is(item)
) { | 1642 if (typeof item == 'string' || core.Iterable.is(item) || core.Map.is(item)
) { |
| 1240 return super.describeMismatch(item, mismatchDescription, matchState, ver
bose); | 1643 return super.describeMismatch(item, mismatchDescription, matchState, ver
bose); |
| 1241 } else { | 1644 } else { |
| 1242 return mismatchDescription.add('is not a string, map or iterable'); | 1645 return mismatchDescription.add('is not a string, map or iterable'); |
| 1243 } | 1646 } |
| 1244 } | 1647 } |
| 1245 }; | 1648 }; |
| 1246 dart.setSignature(src__core_matchers._Contains, { | 1649 dart.setSignature(src__core_matchers._Contains, { |
| 1247 constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._Con
tains, [dart.dynamic])}), | 1650 constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._Con
tains, [dart.dynamic])}), |
| 1248 methods: () => ({ | 1651 methods: () => ({ |
| 1249 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), | 1652 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), |
| 1250 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) | 1653 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) |
| 1251 }) | 1654 }) |
| 1252 }); | 1655 }); |
| 1656 src__core_matchers.isIn = function(expected) { |
| 1657 return new src__core_matchers._In(expected); |
| 1658 }; |
| 1659 dart.fn(src__core_matchers.isIn, dynamicToMatcher()); |
| 1253 src__core_matchers._In = class _In extends src__interfaces.Matcher { | 1660 src__core_matchers._In = class _In extends src__interfaces.Matcher { |
| 1254 new(expected) { | 1661 new(expected) { |
| 1255 this[_expected] = expected; | 1662 this[_expected$] = expected; |
| 1256 super.new(); | 1663 super.new(); |
| 1257 } | 1664 } |
| 1258 matches(item, matchState) { | 1665 matches(item, matchState) { |
| 1259 if (typeof this[_expected] == 'string') { | 1666 if (typeof this[_expected$] == 'string') { |
| 1260 return core.bool._check(dart.dsend(dart.dsend(this[_expected], 'indexOf'
, item), '>=', 0)); | 1667 return core.bool._check(dart.dsend(dart.dsend(this[_expected$], 'indexOf
', item), '>=', 0)); |
| 1261 } else if (core.Iterable.is(this[_expected])) { | 1668 } else if (core.Iterable.is(this[_expected$])) { |
| 1262 return core.bool._check(dart.dsend(this[_expected], 'any', dart.fn(e =>
dart.equals(e, item), dynamicTobool$()))); | 1669 return core.bool._check(dart.dsend(this[_expected$], 'any', dart.fn(e =>
dart.equals(e, item), dynamicTobool$()))); |
| 1263 } else if (core.Map.is(this[_expected])) { | 1670 } else if (core.Map.is(this[_expected$])) { |
| 1264 return core.bool._check(dart.dsend(this[_expected], 'containsKey', item)
); | 1671 return core.bool._check(dart.dsend(this[_expected$], 'containsKey', item
)); |
| 1265 } | 1672 } |
| 1266 return false; | 1673 return false; |
| 1267 } | 1674 } |
| 1268 describe(description) { | 1675 describe(description) { |
| 1269 return description.add('is in ').addDescriptionOf(this[_expected]); | 1676 return description.add('is in ').addDescriptionOf(this[_expected$]); |
| 1270 } | 1677 } |
| 1271 }; | 1678 }; |
| 1272 dart.setSignature(src__core_matchers._In, { | 1679 dart.setSignature(src__core_matchers._In, { |
| 1273 constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._In,
[dart.dynamic])}), | 1680 constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._In,
[dart.dynamic])}), |
| 1274 methods: () => ({ | 1681 methods: () => ({ |
| 1275 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), | 1682 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), |
| 1276 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) | 1683 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) |
| 1277 }) | 1684 }) |
| 1278 }); | 1685 }); |
| 1686 src__core_matchers.predicate = function(f, description) { |
| 1687 if (description === void 0) description = 'satisfies function'; |
| 1688 return new src__core_matchers._Predicate(f, description); |
| 1689 }; |
| 1690 dart.fn(src__core_matchers.predicate, Fn__ToMatcher()); |
| 1279 src__core_matchers._PredicateFunction = dart.typedef('_PredicateFunction', ()
=> dart.functionType(core.bool, [dart.dynamic])); | 1691 src__core_matchers._PredicateFunction = dart.typedef('_PredicateFunction', ()
=> dart.functionType(core.bool, [dart.dynamic])); |
| 1280 const _description = Symbol('_description'); | 1692 const _description$ = Symbol('_description'); |
| 1281 src__core_matchers._Predicate = class _Predicate extends src__interfaces.Match
er { | 1693 src__core_matchers._Predicate = class _Predicate extends src__interfaces.Match
er { |
| 1282 new(matcher, description) { | 1694 new(matcher, description) { |
| 1283 this[_matcher] = matcher; | 1695 this[_matcher$1] = matcher; |
| 1284 this[_description] = description; | 1696 this[_description$] = description; |
| 1285 super.new(); | 1697 super.new(); |
| 1286 } | 1698 } |
| 1287 matches(item, matchState) { | 1699 matches(item, matchState) { |
| 1288 return dart.dcall(this[_matcher], item); | 1700 return dart.dcall(this[_matcher$1], item); |
| 1289 } | 1701 } |
| 1290 describe(description) { | 1702 describe(description) { |
| 1291 return description.add(this[_description]); | 1703 return description.add(this[_description$]); |
| 1292 } | 1704 } |
| 1293 }; | 1705 }; |
| 1294 dart.setSignature(src__core_matchers._Predicate, { | 1706 dart.setSignature(src__core_matchers._Predicate, { |
| 1295 constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._Pre
dicate, [src__core_matchers._PredicateFunction, core.String])}), | 1707 constructors: () => ({new: dart.definiteFunctionType(src__core_matchers._Pre
dicate, [src__core_matchers._PredicateFunction, core.String])}), |
| 1296 methods: () => ({ | 1708 methods: () => ({ |
| 1297 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), | 1709 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), |
| 1298 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) | 1710 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) |
| 1299 }) | 1711 }) |
| 1300 }); | 1712 }); |
| 1301 const _matcher$0 = Symbol('_matcher'); | 1713 const _featureDescription = Symbol('_featureDescription'); |
| 1302 src__iterable_matchers._IterableMatcher = class _IterableMatcher extends src__
interfaces.Matcher { | 1714 const _featureName = Symbol('_featureName'); |
| 1303 new() { | 1715 src__core_matchers.CustomMatcher = class CustomMatcher extends src__interfaces
.Matcher { |
| 1304 super.new(); | 1716 new(featureDescription, featureName, matcher) { |
| 1717 this[_featureDescription] = featureDescription; |
| 1718 this[_featureName] = featureName; |
| 1719 this[_matcher$1] = src__util.wrapMatcher(matcher); |
| 1720 super.new(); |
| 1721 } |
| 1722 featureValueOf(actual) { |
| 1723 return actual; |
| 1724 } |
| 1725 matches(item, matchState) { |
| 1726 let f = this.featureValueOf(item); |
| 1727 if (dart.test(this[_matcher$1].matches(f, matchState))) return true; |
| 1728 src__util.addStateInfo(matchState, dart.map({feature: f})); |
| 1729 return false; |
| 1730 } |
| 1731 describe(description) { |
| 1732 return description.add(this[_featureDescription]).add(' ').addDescriptionO
f(this[_matcher$1]); |
| 1305 } | 1733 } |
| 1306 describeMismatch(item, mismatchDescription, matchState, verbose) { | 1734 describeMismatch(item, mismatchDescription, matchState, verbose) { |
| 1307 if (!core.Iterable.is(item)) { | 1735 mismatchDescription.add('has ').add(this[_featureName]).add(' with value '
).addDescriptionOf(matchState[dartx.get]('feature')); |
| 1308 return mismatchDescription.addDescriptionOf(item).add(' not an Iterable'
); | 1736 let innerDescription = new src__description.StringDescription(); |
| 1309 } else { | 1737 this[_matcher$1].describeMismatch(matchState[dartx.get]('feature'), innerD
escription, core.Map._check(matchState[dartx.get]('state')), verbose); |
| 1310 return super.describeMismatch(item, mismatchDescription, matchState, ver
bose); | 1738 if (dart.notNull(innerDescription.length) > 0) { |
| 1311 } | 1739 mismatchDescription.add(' which ').add(innerDescription.toString()); |
| 1312 } | 1740 } |
| 1313 }; | 1741 return mismatchDescription; |
| 1314 dart.setSignature(src__iterable_matchers._IterableMatcher, { | 1742 } |
| 1315 constructors: () => ({new: dart.definiteFunctionType(src__iterable_matchers.
_IterableMatcher, [])}) | 1743 }; |
| 1316 }); | 1744 dart.setSignature(src__core_matchers.CustomMatcher, { |
| 1317 src__iterable_matchers._EveryElement = class _EveryElement extends src__iterab
le_matchers._IterableMatcher { | 1745 constructors: () => ({new: dart.definiteFunctionType(src__core_matchers.Cust
omMatcher, [core.String, core.String, dart.dynamic])}), |
| 1318 new(matcher) { | 1746 methods: () => ({ |
| 1319 this[_matcher$0] = matcher; | 1747 featureValueOf: dart.definiteFunctionType(dart.dynamic, [dart.dynamic]), |
| 1320 super.new(); | 1748 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), |
| 1321 } | 1749 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) |
| 1322 matches(item, matchState) { | 1750 }) |
| 1323 if (!core.Iterable.is(item)) { | 1751 }); |
| 1324 return false; | 1752 src__numeric_matchers.greaterThan = function(value) { |
| 1325 } | 1753 return new src__numeric_matchers._OrderingComparison(value, false, false, tr
ue, 'a value greater than'); |
| 1326 let i = 0; | 1754 }; |
| 1327 for (let element of core.Iterable._check(item)) { | 1755 dart.fn(src__numeric_matchers.greaterThan, dynamicToMatcher()); |
| 1328 if (!dart.test(this[_matcher$0].matches(element, matchState))) { | 1756 src__numeric_matchers.greaterThanOrEqualTo = function(value) { |
| 1329 src__util.addStateInfo(matchState, dart.map({index: i, element: elemen
t})); | 1757 return new src__numeric_matchers._OrderingComparison(value, true, false, tru
e, 'a value greater than or equal to'); |
| 1330 return false; | 1758 }; |
| 1331 } | 1759 dart.fn(src__numeric_matchers.greaterThanOrEqualTo, dynamicToMatcher()); |
| 1332 ++i; | 1760 src__numeric_matchers.lessThan = function(value) { |
| 1333 } | 1761 return new src__numeric_matchers._OrderingComparison(value, false, true, fal
se, 'a value less than'); |
| 1334 return true; | 1762 }; |
| 1335 } | 1763 dart.fn(src__numeric_matchers.lessThan, dynamicToMatcher()); |
| 1336 describe(description) { | 1764 src__numeric_matchers.lessThanOrEqualTo = function(value) { |
| 1337 return description.add('every element(').addDescriptionOf(this[_matcher$0]
).add(')'); | 1765 return new src__numeric_matchers._OrderingComparison(value, true, true, fals
e, 'a value less than or equal to'); |
| 1766 }; |
| 1767 dart.fn(src__numeric_matchers.lessThanOrEqualTo, dynamicToMatcher()); |
| 1768 const _value$1 = Symbol('_value'); |
| 1769 const _equalValue = Symbol('_equalValue'); |
| 1770 const _lessThanValue = Symbol('_lessThanValue'); |
| 1771 const _greaterThanValue = Symbol('_greaterThanValue'); |
| 1772 const _comparisonDescription = Symbol('_comparisonDescription'); |
| 1773 const _valueInDescription = Symbol('_valueInDescription'); |
| 1774 src__numeric_matchers._OrderingComparison = class _OrderingComparison extends
src__interfaces.Matcher { |
| 1775 new(value, equalValue, lessThanValue, greaterThanValue, comparisonDescriptio
n, valueInDescription) { |
| 1776 if (valueInDescription === void 0) valueInDescription = true; |
| 1777 this[_value$1] = value; |
| 1778 this[_equalValue] = equalValue; |
| 1779 this[_lessThanValue] = lessThanValue; |
| 1780 this[_greaterThanValue] = greaterThanValue; |
| 1781 this[_comparisonDescription] = comparisonDescription; |
| 1782 this[_valueInDescription] = valueInDescription; |
| 1783 super.new(); |
| 1784 } |
| 1785 matches(item, matchState) { |
| 1786 if (dart.equals(item, this[_value$1])) { |
| 1787 return this[_equalValue]; |
| 1788 } else if (dart.test(dart.dsend(item, '<', this[_value$1]))) { |
| 1789 return this[_lessThanValue]; |
| 1790 } else { |
| 1791 return this[_greaterThanValue]; |
| 1792 } |
| 1793 } |
| 1794 describe(description) { |
| 1795 if (dart.test(this[_valueInDescription])) { |
| 1796 return description.add(this[_comparisonDescription]).add(' ').addDescrip
tionOf(this[_value$1]); |
| 1797 } else { |
| 1798 return description.add(this[_comparisonDescription]); |
| 1799 } |
| 1338 } | 1800 } |
| 1339 describeMismatch(item, mismatchDescription, matchState, verbose) { | 1801 describeMismatch(item, mismatchDescription, matchState, verbose) { |
| 1340 if (matchState[dartx.get]('index') != null) { | 1802 mismatchDescription.add('is not '); |
| 1341 let index = matchState[dartx.get]('index'); | 1803 return this.describe(mismatchDescription); |
| 1342 let element = matchState[dartx.get]('element'); | 1804 } |
| 1343 mismatchDescription.add('has value ').addDescriptionOf(element).add(' wh
ich '); | 1805 }; |
| 1344 let subDescription = new src__description.StringDescription(); | 1806 dart.setSignature(src__numeric_matchers._OrderingComparison, { |
| 1345 this[_matcher$0].describeMismatch(element, subDescription, core.Map._che
ck(matchState[dartx.get]('state')), verbose); | 1807 constructors: () => ({new: dart.definiteFunctionType(src__numeric_matchers._
OrderingComparison, [dart.dynamic, core.bool, core.bool, core.bool, core.String]
, [core.bool])}), |
| 1346 if (dart.notNull(subDescription.length) > 0) { | 1808 methods: () => ({ |
| 1347 mismatchDescription.add(subDescription.toString()); | 1809 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), |
| 1348 } else { | 1810 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) |
| 1349 mismatchDescription.add("doesn't match "); | 1811 }) |
| 1350 this[_matcher$0].describe(mismatchDescription); | 1812 }); |
| 1351 } | 1813 src__numeric_matchers.isZero = dart.const(new src__numeric_matchers._OrderingC
omparison(0, true, false, false, 'a value equal to')); |
| 1352 mismatchDescription.add(dart.str` at index ${index}`); | 1814 src__numeric_matchers.isNonZero = dart.const(new src__numeric_matchers._Orderi
ngComparison(0, false, true, true, 'a value not equal to')); |
| 1353 return mismatchDescription; | 1815 src__numeric_matchers.isPositive = dart.const(new src__numeric_matchers._Order
ingComparison(0, false, false, true, 'a positive value', false)); |
| 1354 } | 1816 src__numeric_matchers.isNonPositive = dart.const(new src__numeric_matchers._Or
deringComparison(0, true, true, false, 'a non-positive value', false)); |
| 1355 return super.describeMismatch(item, mismatchDescription, matchState, verbo
se); | 1817 src__numeric_matchers.isNegative = dart.const(new src__numeric_matchers._Order
ingComparison(0, false, true, false, 'a negative value', false)); |
| 1356 } | 1818 src__numeric_matchers.isNonNegative = dart.const(new src__numeric_matchers._Or
deringComparison(0, true, false, true, 'a non-negative value', false)); |
| 1357 }; | |
| 1358 dart.setSignature(src__iterable_matchers._EveryElement, { | |
| 1359 constructors: () => ({new: dart.definiteFunctionType(src__iterable_matchers.
_EveryElement, [src__interfaces.Matcher])}), | |
| 1360 methods: () => ({ | |
| 1361 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), | |
| 1362 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) | |
| 1363 }) | |
| 1364 }); | |
| 1365 src__iterable_matchers._AnyElement = class _AnyElement extends src__iterable_m
atchers._IterableMatcher { | |
| 1366 new(matcher) { | |
| 1367 this[_matcher$0] = matcher; | |
| 1368 super.new(); | |
| 1369 } | |
| 1370 matches(item, matchState) { | |
| 1371 return core.bool._check(dart.dsend(item, 'any', dart.fn(e => this[_matcher
$0].matches(e, matchState), dynamicTobool$()))); | |
| 1372 } | |
| 1373 describe(description) { | |
| 1374 return description.add('some element ').addDescriptionOf(this[_matcher$0])
; | |
| 1375 } | |
| 1376 }; | |
| 1377 dart.setSignature(src__iterable_matchers._AnyElement, { | |
| 1378 constructors: () => ({new: dart.definiteFunctionType(src__iterable_matchers.
_AnyElement, [src__interfaces.Matcher])}), | |
| 1379 methods: () => ({ | |
| 1380 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), | |
| 1381 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) | |
| 1382 }) | |
| 1383 }); | |
| 1384 const _expected$ = Symbol('_expected'); | |
| 1385 src__iterable_matchers._OrderedEquals = class _OrderedEquals extends src__inte
rfaces.Matcher { | |
| 1386 new(expected) { | |
| 1387 this[_expected$] = expected; | |
| 1388 this[_matcher$0] = null; | |
| 1389 super.new(); | |
| 1390 this[_matcher$0] = src__core_matchers.equals(this[_expected$], 1); | |
| 1391 } | |
| 1392 matches(item, matchState) { | |
| 1393 return core.Iterable.is(item) && dart.test(this[_matcher$0].matches(item,
matchState)); | |
| 1394 } | |
| 1395 describe(description) { | |
| 1396 return description.add('equals ').addDescriptionOf(this[_expected$]).add('
ordered'); | |
| 1397 } | |
| 1398 describeMismatch(item, mismatchDescription, matchState, verbose) { | |
| 1399 if (!core.Iterable.is(item)) { | |
| 1400 return mismatchDescription.add('is not an Iterable'); | |
| 1401 } else { | |
| 1402 return this[_matcher$0].describeMismatch(item, mismatchDescription, matc
hState, verbose); | |
| 1403 } | |
| 1404 } | |
| 1405 }; | |
| 1406 dart.setSignature(src__iterable_matchers._OrderedEquals, { | |
| 1407 constructors: () => ({new: dart.definiteFunctionType(src__iterable_matchers.
_OrderedEquals, [core.Iterable])}), | |
| 1408 methods: () => ({ | |
| 1409 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), | |
| 1410 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) | |
| 1411 }) | |
| 1412 }); | |
| 1413 const _expectedValues = Symbol('_expectedValues'); | |
| 1414 const _test = Symbol('_test'); | |
| 1415 src__iterable_matchers._UnorderedMatches = class _UnorderedMatches extends src
__interfaces.Matcher { | |
| 1416 new(expected) { | |
| 1417 this[_expected$] = expected[dartx.map](src__interfaces.Matcher)(src__util.
wrapMatcher)[dartx.toList](); | |
| 1418 super.new(); | |
| 1419 } | |
| 1420 [_test](item) { | |
| 1421 if (!core.Iterable.is(item)) return 'not iterable'; | |
| 1422 item = dart.dsend(item, 'toList'); | |
| 1423 if (dart.notNull(this[_expected$][dartx.length]) > dart.notNull(core.num._
check(dart.dload(item, 'length')))) { | |
| 1424 return dart.str`has too few elements (${dart.dload(item, 'length')} < ${
this[_expected$][dartx.length]})`; | |
| 1425 } else if (dart.notNull(this[_expected$][dartx.length]) < dart.notNull(cor
e.num._check(dart.dload(item, 'length')))) { | |
| 1426 return dart.str`has too many elements (${dart.dload(item, 'length')} > $
{this[_expected$][dartx.length]})`; | |
| 1427 } | |
| 1428 let matched = ListOfbool().filled(core.int._check(dart.dload(item, 'length
')), false); | |
| 1429 let expectedPosition = 0; | |
| 1430 for (let expectedMatcher of this[_expected$]) { | |
| 1431 let actualPosition = 0; | |
| 1432 let gotMatch = false; | |
| 1433 for (let actualElement of core.Iterable._check(item)) { | |
| 1434 if (!dart.test(matched[dartx.get](actualPosition))) { | |
| 1435 if (dart.test(expectedMatcher.matches(actualElement, dart.map()))) { | |
| 1436 matched[dartx.set](actualPosition, gotMatch = true); | |
| 1437 break; | |
| 1438 } | |
| 1439 } | |
| 1440 ++actualPosition; | |
| 1441 } | |
| 1442 if (!gotMatch) { | |
| 1443 return dart.toString(new src__description.StringDescription().add('has
no match for ').addDescriptionOf(expectedMatcher).add(dart.str` at index ${expe
ctedPosition}`)); | |
| 1444 } | |
| 1445 ++expectedPosition; | |
| 1446 } | |
| 1447 return null; | |
| 1448 } | |
| 1449 matches(item, mismatchState) { | |
| 1450 return this[_test](item) == null; | |
| 1451 } | |
| 1452 describe(description) { | |
| 1453 return description.add('matches ').addAll('[', ', ', ']', this[_expected$]
).add(' unordered'); | |
| 1454 } | |
| 1455 describeMismatch(item, mismatchDescription, matchState, verbose) { | |
| 1456 return mismatchDescription.add(this[_test](item)); | |
| 1457 } | |
| 1458 }; | |
| 1459 dart.setSignature(src__iterable_matchers._UnorderedMatches, { | |
| 1460 constructors: () => ({new: dart.definiteFunctionType(src__iterable_matchers.
_UnorderedMatches, [core.Iterable])}), | |
| 1461 methods: () => ({ | |
| 1462 [_test]: dart.definiteFunctionType(core.String, [dart.dynamic]), | |
| 1463 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), | |
| 1464 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) | |
| 1465 }) | |
| 1466 }); | |
| 1467 src__iterable_matchers._UnorderedEquals = class _UnorderedEquals extends src__
iterable_matchers._UnorderedMatches { | |
| 1468 new(expected) { | |
| 1469 this[_expectedValues] = expected[dartx.toList](); | |
| 1470 super.new(expected[dartx.map](src__interfaces.Matcher)(src__core_matchers.
equals)); | |
| 1471 } | |
| 1472 describe(description) { | |
| 1473 return description.add('equals ').addDescriptionOf(this[_expectedValues]).
add(' unordered'); | |
| 1474 } | |
| 1475 }; | |
| 1476 dart.setSignature(src__iterable_matchers._UnorderedEquals, { | |
| 1477 constructors: () => ({new: dart.definiteFunctionType(src__iterable_matchers.
_UnorderedEquals, [core.Iterable])}) | |
| 1478 }); | |
| 1479 src__iterable_matchers._Comparator = dart.typedef('_Comparator', () => dart.fu
nctionType(core.bool, [dart.dynamic, dart.dynamic])); | |
| 1480 const _comparator = Symbol('_comparator'); | |
| 1481 const _description$ = Symbol('_description'); | |
| 1482 src__iterable_matchers._PairwiseCompare = class _PairwiseCompare extends src__
iterable_matchers._IterableMatcher { | |
| 1483 new(expected, comparator, description) { | |
| 1484 this[_expected$] = expected; | |
| 1485 this[_comparator] = comparator; | |
| 1486 this[_description$] = description; | |
| 1487 super.new(); | |
| 1488 } | |
| 1489 matches(item, matchState) { | |
| 1490 if (!core.Iterable.is(item)) return false; | |
| 1491 if (!dart.equals(dart.dload(item, 'length'), this[_expected$][dartx.length
])) return false; | |
| 1492 let iterator = dart.dload(item, 'iterator'); | |
| 1493 let i = 0; | |
| 1494 for (let e of this[_expected$]) { | |
| 1495 dart.dsend(iterator, 'moveNext'); | |
| 1496 if (!dart.test(dart.dcall(this[_comparator], e, dart.dload(iterator, 'cu
rrent')))) { | |
| 1497 src__util.addStateInfo(matchState, dart.map({index: i, expected: e, ac
tual: dart.dload(iterator, 'current')})); | |
| 1498 return false; | |
| 1499 } | |
| 1500 i++; | |
| 1501 } | |
| 1502 return true; | |
| 1503 } | |
| 1504 describe(description) { | |
| 1505 return description.add(dart.str`pairwise ${this[_description$]} `).addDesc
riptionOf(this[_expected$]); | |
| 1506 } | |
| 1507 describeMismatch(item, mismatchDescription, matchState, verbose) { | |
| 1508 if (!core.Iterable.is(item)) { | |
| 1509 return mismatchDescription.add('is not an Iterable'); | |
| 1510 } else if (!dart.equals(dart.dload(item, 'length'), this[_expected$][dartx
.length])) { | |
| 1511 return mismatchDescription.add(dart.str`has length ${dart.dload(item, 'l
ength')} instead of ${this[_expected$][dartx.length]}`); | |
| 1512 } else { | |
| 1513 return mismatchDescription.add('has ').addDescriptionOf(matchState[dartx
.get]("actual")).add(dart.str` which is not ${this[_description$]} `).addDescrip
tionOf(matchState[dartx.get]("expected")).add(dart.str` at index ${matchState[da
rtx.get]("index")}`); | |
| 1514 } | |
| 1515 } | |
| 1516 }; | |
| 1517 dart.setSignature(src__iterable_matchers._PairwiseCompare, { | |
| 1518 constructors: () => ({new: dart.definiteFunctionType(src__iterable_matchers.
_PairwiseCompare, [core.Iterable, src__iterable_matchers._Comparator, core.Strin
g])}), | |
| 1519 methods: () => ({ | |
| 1520 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), | |
| 1521 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) | |
| 1522 }) | |
| 1523 }); | |
| 1524 const _value$0 = Symbol('_value'); | |
| 1525 src__map_matchers._ContainsValue = class _ContainsValue extends src__interface
s.Matcher { | |
| 1526 new(value) { | |
| 1527 this[_value$0] = value; | |
| 1528 super.new(); | |
| 1529 } | |
| 1530 matches(item, matchState) { | |
| 1531 return core.bool._check(dart.dsend(item, 'containsValue', this[_value$0]))
; | |
| 1532 } | |
| 1533 describe(description) { | |
| 1534 return description.add('contains value ').addDescriptionOf(this[_value$0])
; | |
| 1535 } | |
| 1536 }; | |
| 1537 dart.setSignature(src__map_matchers._ContainsValue, { | |
| 1538 constructors: () => ({new: dart.definiteFunctionType(src__map_matchers._Cont
ainsValue, [dart.dynamic])}), | |
| 1539 methods: () => ({ | |
| 1540 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), | |
| 1541 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) | |
| 1542 }) | |
| 1543 }); | |
| 1544 const _key = Symbol('_key'); | |
| 1545 const _valueMatcher = Symbol('_valueMatcher'); | |
| 1546 src__map_matchers._ContainsMapping = class _ContainsMapping extends src__inter
faces.Matcher { | |
| 1547 new(key, valueMatcher) { | |
| 1548 this[_key] = key; | |
| 1549 this[_valueMatcher] = valueMatcher; | |
| 1550 super.new(); | |
| 1551 } | |
| 1552 matches(item, matchState) { | |
| 1553 return dart.test(dart.dsend(item, 'containsKey', this[_key])) && dart.test
(this[_valueMatcher].matches(dart.dindex(item, this[_key]), matchState)); | |
| 1554 } | |
| 1555 describe(description) { | |
| 1556 return description.add('contains pair ').addDescriptionOf(this[_key]).add(
' => ').addDescriptionOf(this[_valueMatcher]); | |
| 1557 } | |
| 1558 describeMismatch(item, mismatchDescription, matchState, verbose) { | |
| 1559 if (!dart.test(dart.dsend(item, 'containsKey', this[_key]))) { | |
| 1560 return mismatchDescription.add(" doesn't contain key ").addDescriptionOf
(this[_key]); | |
| 1561 } else { | |
| 1562 mismatchDescription.add(' contains key ').addDescriptionOf(this[_key]).a
dd(' but with value '); | |
| 1563 this[_valueMatcher].describeMismatch(dart.dindex(item, this[_key]), mism
atchDescription, matchState, verbose); | |
| 1564 return mismatchDescription; | |
| 1565 } | |
| 1566 } | |
| 1567 }; | |
| 1568 dart.setSignature(src__map_matchers._ContainsMapping, { | |
| 1569 constructors: () => ({new: dart.definiteFunctionType(src__map_matchers._Cont
ainsMapping, [dart.dynamic, src__interfaces.Matcher])}), | |
| 1570 methods: () => ({ | |
| 1571 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), | |
| 1572 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) | |
| 1573 }) | |
| 1574 }); | |
| 1575 src__numeric_matchers._isNumeric = function(value) { | 1819 src__numeric_matchers._isNumeric = function(value) { |
| 1576 return typeof value == 'number'; | 1820 return typeof value == 'number'; |
| 1577 }; | 1821 }; |
| 1578 dart.fn(src__numeric_matchers._isNumeric, dynamicTobool$()); | 1822 dart.fn(src__numeric_matchers._isNumeric, dynamicTobool$()); |
| 1823 src__numeric_matchers.closeTo = function(value, delta) { |
| 1824 return new src__numeric_matchers._IsCloseTo(value, delta); |
| 1825 }; |
| 1826 dart.fn(src__numeric_matchers.closeTo, numAndnumToMatcher()); |
| 1579 const _delta = Symbol('_delta'); | 1827 const _delta = Symbol('_delta'); |
| 1580 src__numeric_matchers._IsCloseTo = class _IsCloseTo extends src__interfaces.Ma
tcher { | 1828 src__numeric_matchers._IsCloseTo = class _IsCloseTo extends src__interfaces.Ma
tcher { |
| 1581 new(value, delta) { | 1829 new(value, delta) { |
| 1582 this[_value] = value; | 1830 this[_value$1] = value; |
| 1583 this[_delta] = delta; | 1831 this[_delta] = delta; |
| 1584 super.new(); | 1832 super.new(); |
| 1585 } | 1833 } |
| 1586 matches(item, matchState) { | 1834 matches(item, matchState) { |
| 1587 if (!dart.test(src__numeric_matchers._isNumeric(item))) { | 1835 if (!dart.test(src__numeric_matchers._isNumeric(item))) { |
| 1588 return false; | 1836 return false; |
| 1589 } | 1837 } |
| 1590 let diff = dart.dsend(item, '-', this[_value]); | 1838 let diff = dart.dsend(item, '-', this[_value$1]); |
| 1591 if (dart.test(dart.dsend(diff, '<', 0))) diff = dart.dsend(diff, 'unary-')
; | 1839 if (dart.test(dart.dsend(diff, '<', 0))) diff = dart.dsend(diff, 'unary-')
; |
| 1592 return core.bool._check(dart.dsend(diff, '<=', this[_delta])); | 1840 return core.bool._check(dart.dsend(diff, '<=', this[_delta])); |
| 1593 } | 1841 } |
| 1594 describe(description) { | 1842 describe(description) { |
| 1595 return description.add('a numeric value within ').addDescriptionOf(this[_d
elta]).add(' of ').addDescriptionOf(this[_value]); | 1843 return description.add('a numeric value within ').addDescriptionOf(this[_d
elta]).add(' of ').addDescriptionOf(this[_value$1]); |
| 1596 } | 1844 } |
| 1597 describeMismatch(item, mismatchDescription, matchState, verbose) { | 1845 describeMismatch(item, mismatchDescription, matchState, verbose) { |
| 1598 if (!(typeof item == 'number')) { | 1846 if (!(typeof item == 'number')) { |
| 1599 return mismatchDescription.add(' not numeric'); | 1847 return mismatchDescription.add(' not numeric'); |
| 1600 } else { | 1848 } else { |
| 1601 let diff = dart.dsend(item, '-', this[_value]); | 1849 let diff = dart.dsend(item, '-', this[_value$1]); |
| 1602 if (dart.test(dart.dsend(diff, '<', 0))) diff = dart.dsend(diff, 'unary-
'); | 1850 if (dart.test(dart.dsend(diff, '<', 0))) diff = dart.dsend(diff, 'unary-
'); |
| 1603 return mismatchDescription.add(' differs by ').addDescriptionOf(diff); | 1851 return mismatchDescription.add(' differs by ').addDescriptionOf(diff); |
| 1604 } | 1852 } |
| 1605 } | 1853 } |
| 1606 }; | 1854 }; |
| 1607 dart.setSignature(src__numeric_matchers._IsCloseTo, { | 1855 dart.setSignature(src__numeric_matchers._IsCloseTo, { |
| 1608 constructors: () => ({new: dart.definiteFunctionType(src__numeric_matchers._
IsCloseTo, [core.num, core.num])}), | 1856 constructors: () => ({new: dart.definiteFunctionType(src__numeric_matchers._
IsCloseTo, [core.num, core.num])}), |
| 1609 methods: () => ({ | 1857 methods: () => ({ |
| 1610 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), | 1858 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), |
| 1611 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) | 1859 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) |
| 1612 }) | 1860 }) |
| 1613 }); | 1861 }); |
| 1862 src__numeric_matchers.inInclusiveRange = function(low, high) { |
| 1863 return new src__numeric_matchers._InRange(low, high, true, true); |
| 1864 }; |
| 1865 dart.fn(src__numeric_matchers.inInclusiveRange, numAndnumToMatcher()); |
| 1866 src__numeric_matchers.inExclusiveRange = function(low, high) { |
| 1867 return new src__numeric_matchers._InRange(low, high, false, false); |
| 1868 }; |
| 1869 dart.fn(src__numeric_matchers.inExclusiveRange, numAndnumToMatcher()); |
| 1870 src__numeric_matchers.inOpenClosedRange = function(low, high) { |
| 1871 return new src__numeric_matchers._InRange(low, high, false, true); |
| 1872 }; |
| 1873 dart.fn(src__numeric_matchers.inOpenClosedRange, numAndnumToMatcher()); |
| 1874 src__numeric_matchers.inClosedOpenRange = function(low, high) { |
| 1875 return new src__numeric_matchers._InRange(low, high, true, false); |
| 1876 }; |
| 1877 dart.fn(src__numeric_matchers.inClosedOpenRange, numAndnumToMatcher()); |
| 1614 const _low = Symbol('_low'); | 1878 const _low = Symbol('_low'); |
| 1615 const _high = Symbol('_high'); | 1879 const _high = Symbol('_high'); |
| 1616 const _lowMatchValue = Symbol('_lowMatchValue'); | 1880 const _lowMatchValue = Symbol('_lowMatchValue'); |
| 1617 const _highMatchValue = Symbol('_highMatchValue'); | 1881 const _highMatchValue = Symbol('_highMatchValue'); |
| 1618 src__numeric_matchers._InRange = class _InRange extends src__interfaces.Matche
r { | 1882 src__numeric_matchers._InRange = class _InRange extends src__interfaces.Matche
r { |
| 1619 new(low, high, lowMatchValue, highMatchValue) { | 1883 new(low, high, lowMatchValue, highMatchValue) { |
| 1620 this[_low] = low; | 1884 this[_low] = low; |
| 1621 this[_high] = high; | 1885 this[_high] = high; |
| 1622 this[_lowMatchValue] = lowMatchValue; | 1886 this[_lowMatchValue] = lowMatchValue; |
| 1623 this[_highMatchValue] = highMatchValue; | 1887 this[_highMatchValue] = highMatchValue; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1649 } | 1913 } |
| 1650 } | 1914 } |
| 1651 }; | 1915 }; |
| 1652 dart.setSignature(src__numeric_matchers._InRange, { | 1916 dart.setSignature(src__numeric_matchers._InRange, { |
| 1653 constructors: () => ({new: dart.definiteFunctionType(src__numeric_matchers._
InRange, [core.num, core.num, core.bool, core.bool])}), | 1917 constructors: () => ({new: dart.definiteFunctionType(src__numeric_matchers._
InRange, [core.num, core.num, core.bool, core.bool])}), |
| 1654 methods: () => ({ | 1918 methods: () => ({ |
| 1655 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), | 1919 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), |
| 1656 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) | 1920 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) |
| 1657 }) | 1921 }) |
| 1658 }); | 1922 }); |
| 1659 const _matcher$1 = Symbol('_matcher'); | 1923 matcher.isTrue = src__core_matchers.isTrue; |
| 1660 src__operator_matchers._IsNot = class _IsNot extends src__interfaces.Matcher { | 1924 matcher.isFalse = src__core_matchers.isFalse; |
| 1661 new(matcher) { | 1925 matcher.isEmpty = src__core_matchers.isEmpty; |
| 1662 this[_matcher$1] = matcher; | 1926 matcher.same = src__core_matchers.same; |
| 1663 super.new(); | 1927 matcher.equals = src__core_matchers.equals; |
| 1664 } | 1928 matcher.CustomMatcher = src__core_matchers.CustomMatcher; |
| 1665 matches(item, matchState) { | 1929 matcher.isList = src__core_matchers.isList; |
| 1666 return !dart.test(this[_matcher$1].matches(item, matchState)); | 1930 matcher.predicate = src__core_matchers.predicate; |
| 1667 } | 1931 matcher.isNotNull = src__core_matchers.isNotNull; |
| 1668 describe(description) { | 1932 matcher.hasLength = src__core_matchers.hasLength; |
| 1669 return description.add('not ').addDescriptionOf(this[_matcher$1]); | 1933 matcher.isInstanceOf$ = src__core_matchers.isInstanceOf$; |
| 1670 } | 1934 matcher.isInstanceOf = src__core_matchers.isInstanceOf; |
| 1671 }; | 1935 matcher.isNaN = src__core_matchers.isNaN; |
| 1672 dart.setSignature(src__operator_matchers._IsNot, { | 1936 matcher.returnsNormally = src__core_matchers.returnsNormally; |
| 1673 constructors: () => ({new: dart.definiteFunctionType(src__operator_matchers.
_IsNot, [src__interfaces.Matcher])}), | 1937 matcher.anything = src__core_matchers.anything; |
| 1674 methods: () => ({ | 1938 matcher.TypeMatcher = src__core_matchers.TypeMatcher; |
| 1675 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), | 1939 matcher.contains = src__core_matchers.contains; |
| 1676 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) | 1940 matcher.isNotEmpty = src__core_matchers.isNotEmpty; |
| 1677 }) | 1941 matcher.isNull = src__core_matchers.isNull; |
| 1678 }); | 1942 matcher.isMap = src__core_matchers.isMap; |
| 1679 const _matchers = Symbol('_matchers'); | 1943 matcher.isNotNaN = src__core_matchers.isNotNaN; |
| 1680 src__operator_matchers._AllOf = class _AllOf extends src__interfaces.Matcher { | 1944 matcher.isIn = src__core_matchers.isIn; |
| 1681 new(matchers) { | 1945 matcher.StringDescription = src__description.StringDescription; |
| 1682 this[_matchers] = matchers; | 1946 matcher.isConcurrentModificationError = src__error_matchers.isConcurrentModifi
cationError; |
| 1683 super.new(); | 1947 matcher.isCyclicInitializationError = src__error_matchers.isCyclicInitializati
onError; |
| 1684 } | 1948 matcher.isArgumentError = src__error_matchers.isArgumentError; |
| 1685 matches(item, matchState) { | 1949 matcher.isException = src__error_matchers.isException; |
| 1686 for (let matcher of this[_matchers]) { | 1950 matcher.isNullThrownError = src__error_matchers.isNullThrownError; |
| 1687 if (!dart.test(matcher.matches(item, matchState))) { | 1951 matcher.isRangeError = src__error_matchers.isRangeError; |
| 1688 src__util.addStateInfo(matchState, dart.map({matcher: matcher})); | 1952 matcher.isFormatException = src__error_matchers.isFormatException; |
| 1689 return false; | 1953 matcher.isStateError = src__error_matchers.isStateError; |
| 1690 } | 1954 matcher.isNoSuchMethodError = src__error_matchers.isNoSuchMethodError; |
| 1691 } | 1955 matcher.isUnimplementedError = src__error_matchers.isUnimplementedError; |
| 1692 return true; | 1956 matcher.isUnsupportedError = src__error_matchers.isUnsupportedError; |
| 1693 } | 1957 matcher.Matcher = src__interfaces.Matcher; |
| 1694 describeMismatch(item, mismatchDescription, matchState, verbose) { | 1958 matcher.Description = src__interfaces.Description; |
| 1695 let matcher = matchState[dartx.get]('matcher'); | 1959 matcher.pairwiseCompare = src__iterable_matchers.pairwiseCompare; |
| 1696 dart.dsend(matcher, 'describeMismatch', item, mismatchDescription, matchSt
ate[dartx.get]('state'), verbose); | 1960 matcher.anyElement = src__iterable_matchers.anyElement; |
| 1697 return mismatchDescription; | 1961 matcher.orderedEquals = src__iterable_matchers.orderedEquals; |
| 1698 } | 1962 matcher.unorderedEquals = src__iterable_matchers.unorderedEquals; |
| 1699 describe(description) { | 1963 matcher.unorderedMatches = src__iterable_matchers.unorderedMatches; |
| 1700 return description.addAll('(', ' and ', ')', this[_matchers]); | 1964 matcher.everyElement = src__iterable_matchers.everyElement; |
| 1701 } | 1965 matcher.containsValue = src__map_matchers.containsValue; |
| 1702 }; | 1966 matcher.containsPair = src__map_matchers.containsPair; |
| 1703 dart.setSignature(src__operator_matchers._AllOf, { | 1967 matcher.isPositive = src__numeric_matchers.isPositive; |
| 1704 constructors: () => ({new: dart.definiteFunctionType(src__operator_matchers.
_AllOf, [core.List$(src__interfaces.Matcher)])}), | 1968 matcher.isZero = src__numeric_matchers.isZero; |
| 1705 methods: () => ({ | 1969 matcher.inOpenClosedRange = src__numeric_matchers.inOpenClosedRange; |
| 1706 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), | 1970 matcher.inClosedOpenRange = src__numeric_matchers.inClosedOpenRange; |
| 1707 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) | 1971 matcher.lessThanOrEqualTo = src__numeric_matchers.lessThanOrEqualTo; |
| 1708 }) | 1972 matcher.isNegative = src__numeric_matchers.isNegative; |
| 1709 }); | 1973 matcher.inInclusiveRange = src__numeric_matchers.inInclusiveRange; |
| 1710 src__operator_matchers._AnyOf = class _AnyOf extends src__interfaces.Matcher { | 1974 matcher.lessThan = src__numeric_matchers.lessThan; |
| 1711 new(matchers) { | 1975 matcher.greaterThan = src__numeric_matchers.greaterThan; |
| 1712 this[_matchers] = matchers; | 1976 matcher.isNonNegative = src__numeric_matchers.isNonNegative; |
| 1713 super.new(); | 1977 matcher.inExclusiveRange = src__numeric_matchers.inExclusiveRange; |
| 1714 } | 1978 matcher.closeTo = src__numeric_matchers.closeTo; |
| 1715 matches(item, matchState) { | 1979 matcher.greaterThanOrEqualTo = src__numeric_matchers.greaterThanOrEqualTo; |
| 1716 for (let matcher of this[_matchers]) { | 1980 matcher.isNonZero = src__numeric_matchers.isNonZero; |
| 1717 if (dart.test(matcher.matches(item, matchState))) { | 1981 matcher.isNonPositive = src__numeric_matchers.isNonPositive; |
| 1718 return true; | 1982 matcher.allOf = src__operator_matchers.allOf; |
| 1719 } | 1983 matcher.isNot = src__operator_matchers.isNot; |
| 1720 } | 1984 matcher.anyOf = src__operator_matchers.anyOf; |
| 1721 return false; | 1985 matcher.endsWith = src__string_matchers.endsWith; |
| 1722 } | 1986 matcher.startsWith = src__string_matchers.startsWith; |
| 1723 describe(description) { | 1987 matcher.matches = src__string_matchers.matches; |
| 1724 return description.addAll('(', ' or ', ')', this[_matchers]); | 1988 matcher.collapseWhitespace = src__string_matchers.collapseWhitespace; |
| 1725 } | 1989 matcher.equalsIgnoringCase = src__string_matchers.equalsIgnoringCase; |
| 1726 }; | 1990 matcher.equalsIgnoringWhitespace = src__string_matchers.equalsIgnoringWhitespa
ce; |
| 1727 dart.setSignature(src__operator_matchers._AnyOf, { | 1991 matcher.stringContainsInOrder = src__string_matchers.stringContainsInOrder; |
| 1728 constructors: () => ({new: dart.definiteFunctionType(src__operator_matchers.
_AnyOf, [core.List$(src__interfaces.Matcher)])}), | 1992 matcher.addStateInfo = src__util.addStateInfo; |
| 1729 methods: () => ({ | 1993 matcher.wrapMatcher = src__util.wrapMatcher; |
| 1730 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), | 1994 matcher.escape = src__util.escape; |
| 1731 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) | |
| 1732 }) | |
| 1733 }); | |
| 1734 src__operator_matchers._wrapArgs = function(arg0, arg1, arg2, arg3, arg4, arg5
, arg6) { | |
| 1735 let args = null; | |
| 1736 if (core.List.is(arg0)) { | |
| 1737 if (arg1 != null || arg2 != null || arg3 != null || arg4 != null || arg5 !
= null || arg6 != null) { | |
| 1738 dart.throw(new core.ArgumentError('If arg0 is a List, all other argument
s must be' + ' null.')); | |
| 1739 } | |
| 1740 args = arg0; | |
| 1741 } else { | |
| 1742 args = [arg0, arg1, arg2, arg3, arg4, arg5, arg6][dartx.where](dart.fn(e =
> e != null, dynamicTobool$())); | |
| 1743 } | |
| 1744 return args[dartx.map](src__interfaces.Matcher)(dart.fn(e => src__util.wrapM
atcher(e), dynamicToMatcher()))[dartx.toList](); | |
| 1745 }; | |
| 1746 dart.fn(src__operator_matchers._wrapArgs, dynamicAnddynamicAnddynamic__ToListO
fMatcher()); | |
| 1747 src__pretty_print.prettyPrint = function(object, opts) { | |
| 1748 let maxLineLength = opts && 'maxLineLength' in opts ? opts.maxLineLength : n
ull; | |
| 1749 let maxItems = opts && 'maxItems' in opts ? opts.maxItems : null; | |
| 1750 function _prettyPrint(object, indent, seen, top) { | |
| 1751 if (src__interfaces.Matcher.is(object)) { | |
| 1752 let description = new src__description.StringDescription(); | |
| 1753 object.describe(description); | |
| 1754 return dart.str`<${description}>`; | |
| 1755 } | |
| 1756 if (dart.test(seen.contains(object))) return "(recursive)"; | |
| 1757 seen = seen.union(core.Set.from([object])); | |
| 1758 function pp(child) { | |
| 1759 return _prettyPrint(child, dart.notNull(indent) + 2, seen, false); | |
| 1760 } | |
| 1761 dart.fn(pp, dynamicToString()); | |
| 1762 if (core.Iterable.is(object)) { | |
| 1763 let type = core.List.is(object) ? "" : dart.notNull(src__pretty_print._t
ypeName(object)) + ":"; | |
| 1764 let strings = object[dartx.map](core.String)(pp)[dartx.toList](); | |
| 1765 if (maxItems != null && dart.notNull(strings[dartx.length]) > dart.notNu
ll(maxItems)) { | |
| 1766 strings[dartx.replaceRange](dart.notNull(maxItems) - 1, strings[dartx.
length], JSArrayOfString().of(['...'])); | |
| 1767 } | |
| 1768 let singleLine = dart.str`${type}[${strings[dartx.join](', ')}]`; | |
| 1769 if ((maxLineLength == null || dart.notNull(singleLine[dartx.length]) + d
art.notNull(indent) <= dart.notNull(maxLineLength)) && !dart.test(singleLine[dar
tx.contains]("\n"))) { | |
| 1770 return singleLine; | |
| 1771 } | |
| 1772 return dart.str`${type}[\n` + dart.notNull(strings[dartx.map](core.Strin
g)(dart.fn(string => dart.notNull(src__pretty_print._indent(dart.notNull(indent)
+ 2)) + dart.notNull(string), StringToString()))[dartx.join](",\n")) + "\n" + d
art.notNull(src__pretty_print._indent(indent)) + "]"; | |
| 1773 } else if (core.Map.is(object)) { | |
| 1774 let strings = object[dartx.keys][dartx.map](core.String)(dart.fn(key =>
dart.str`${pp(key)}: ${pp(object[dartx.get](key))}`, dynamicToString()))[dartx.t
oList](); | |
| 1775 if (maxItems != null && dart.notNull(strings[dartx.length]) > dart.notNu
ll(maxItems)) { | |
| 1776 strings[dartx.replaceRange](dart.notNull(maxItems) - 1, strings[dartx.
length], JSArrayOfString().of(['...'])); | |
| 1777 } | |
| 1778 let singleLine = dart.str`{${strings[dartx.join](", ")}}`; | |
| 1779 if ((maxLineLength == null || dart.notNull(singleLine[dartx.length]) + d
art.notNull(indent) <= dart.notNull(maxLineLength)) && !dart.test(singleLine[dar
tx.contains]("\n"))) { | |
| 1780 return singleLine; | |
| 1781 } | |
| 1782 return "{\n" + dart.notNull(strings[dartx.map](core.String)(dart.fn(stri
ng => dart.notNull(src__pretty_print._indent(dart.notNull(indent) + 2)) + dart.n
otNull(string), StringToString()))[dartx.join](",\n")) + "\n" + dart.notNull(src
__pretty_print._indent(indent)) + "}"; | |
| 1783 } else if (typeof object == 'string') { | |
| 1784 let lines = object[dartx.split]("\n"); | |
| 1785 return "'" + dart.notNull(lines[dartx.map](core.String)(src__pretty_prin
t._escapeString)[dartx.join](dart.str`\\n'\n${src__pretty_print._indent(dart.not
Null(indent) + 2)}'`)) + "'"; | |
| 1786 } else { | |
| 1787 let value = dart.toString(object)[dartx.replaceAll]("\n", dart.notNull(s
rc__pretty_print._indent(indent)) + "\n"); | |
| 1788 let defaultToString = value[dartx.startsWith]("Instance of "); | |
| 1789 if (dart.test(top)) value = dart.str`<${value}>`; | |
| 1790 if (typeof object == 'number' || typeof object == 'boolean' || core.Func
tion.is(object) || object == null || dart.test(defaultToString)) { | |
| 1791 return value; | |
| 1792 } else { | |
| 1793 return dart.str`${src__pretty_print._typeName(object)}:${value}`; | |
| 1794 } | |
| 1795 } | |
| 1796 } | |
| 1797 dart.fn(_prettyPrint, dynamicAndintAndSet__ToString()); | |
| 1798 return _prettyPrint(object, 0, core.Set.new(), true); | |
| 1799 }; | |
| 1800 dart.fn(src__pretty_print.prettyPrint, dynamic__ToString()); | |
| 1801 src__pretty_print._indent = function(length) { | |
| 1802 return core.List.filled(length, ' ')[dartx.join](''); | |
| 1803 }; | |
| 1804 dart.fn(src__pretty_print._indent, intToString()); | |
| 1805 src__pretty_print._typeName = function(x) { | |
| 1806 try { | |
| 1807 if (x == null) return "null"; | |
| 1808 let type = dart.toString(dart.runtimeType(x)); | |
| 1809 return dart.test(type[dartx.startsWith]("_")) ? "?" : type; | |
| 1810 } catch (e) { | |
| 1811 return "?"; | |
| 1812 } | |
| 1813 | |
| 1814 }; | |
| 1815 dart.fn(src__pretty_print._typeName, dynamicToString()); | |
| 1816 src__pretty_print._escapeString = function(source) { | |
| 1817 return src__util.escape(source)[dartx.replaceAll]("'", "\\'"); | |
| 1818 }; | |
| 1819 dart.fn(src__pretty_print._escapeString, StringToString()); | |
| 1820 const _value$1 = Symbol('_value'); | |
| 1821 const _matchValue = Symbol('_matchValue'); | |
| 1822 src__string_matchers._StringMatcher = class _StringMatcher extends src__interf
aces.Matcher { | |
| 1823 new() { | |
| 1824 super.new(); | |
| 1825 } | |
| 1826 describeMismatch(item, mismatchDescription, matchState, verbose) { | |
| 1827 if (!(typeof item == 'string')) { | |
| 1828 return mismatchDescription.addDescriptionOf(item).add(' not a string'); | |
| 1829 } else { | |
| 1830 return super.describeMismatch(item, mismatchDescription, matchState, ver
bose); | |
| 1831 } | |
| 1832 } | |
| 1833 }; | |
| 1834 dart.setSignature(src__string_matchers._StringMatcher, { | |
| 1835 constructors: () => ({new: dart.definiteFunctionType(src__string_matchers._S
tringMatcher, [])}) | |
| 1836 }); | |
| 1837 src__string_matchers._IsEqualIgnoringCase = class _IsEqualIgnoringCase extends
src__string_matchers._StringMatcher { | |
| 1838 new(value) { | |
| 1839 this[_value$1] = value; | |
| 1840 this[_matchValue] = value[dartx.toLowerCase](); | |
| 1841 super.new(); | |
| 1842 } | |
| 1843 matches(item, matchState) { | |
| 1844 return typeof item == 'string' && this[_matchValue] == item[dartx.toLowerC
ase](); | |
| 1845 } | |
| 1846 describe(description) { | |
| 1847 return description.addDescriptionOf(this[_value$1]).add(' ignoring case'); | |
| 1848 } | |
| 1849 }; | |
| 1850 dart.setSignature(src__string_matchers._IsEqualIgnoringCase, { | |
| 1851 constructors: () => ({new: dart.definiteFunctionType(src__string_matchers._I
sEqualIgnoringCase, [core.String])}), | |
| 1852 methods: () => ({ | |
| 1853 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), | |
| 1854 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) | |
| 1855 }) | |
| 1856 }); | |
| 1857 src__string_matchers._IsEqualIgnoringWhitespace = class _IsEqualIgnoringWhites
pace extends src__string_matchers._StringMatcher { | |
| 1858 new(value) { | |
| 1859 this[_value$1] = value; | |
| 1860 this[_matchValue] = src__string_matchers.collapseWhitespace(value); | |
| 1861 super.new(); | |
| 1862 } | |
| 1863 matches(item, matchState) { | |
| 1864 return typeof item == 'string' && this[_matchValue] == src__string_matcher
s.collapseWhitespace(item); | |
| 1865 } | |
| 1866 describe(description) { | |
| 1867 return description.addDescriptionOf(this[_matchValue]).add(' ignoring whit
espace'); | |
| 1868 } | |
| 1869 describeMismatch(item, mismatchDescription, matchState, verbose) { | |
| 1870 if (typeof item == 'string') { | |
| 1871 return mismatchDescription.add('is ').addDescriptionOf(src__string_match
ers.collapseWhitespace(item)).add(' with whitespace compressed'); | |
| 1872 } else { | |
| 1873 return super.describeMismatch(item, mismatchDescription, matchState, ver
bose); | |
| 1874 } | |
| 1875 } | |
| 1876 }; | |
| 1877 dart.setSignature(src__string_matchers._IsEqualIgnoringWhitespace, { | |
| 1878 constructors: () => ({new: dart.definiteFunctionType(src__string_matchers._I
sEqualIgnoringWhitespace, [core.String])}), | |
| 1879 methods: () => ({ | |
| 1880 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), | |
| 1881 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) | |
| 1882 }) | |
| 1883 }); | |
| 1884 const _prefix = Symbol('_prefix'); | |
| 1885 src__string_matchers._StringStartsWith = class _StringStartsWith extends src__
string_matchers._StringMatcher { | |
| 1886 new(prefix) { | |
| 1887 this[_prefix] = prefix; | |
| 1888 super.new(); | |
| 1889 } | |
| 1890 matches(item, matchState) { | |
| 1891 return typeof item == 'string' && dart.test(item[dartx.startsWith](this[_p
refix])); | |
| 1892 } | |
| 1893 describe(description) { | |
| 1894 return description.add('a string starting with ').addDescriptionOf(this[_p
refix]); | |
| 1895 } | |
| 1896 }; | |
| 1897 dart.setSignature(src__string_matchers._StringStartsWith, { | |
| 1898 constructors: () => ({new: dart.definiteFunctionType(src__string_matchers._S
tringStartsWith, [core.String])}), | |
| 1899 methods: () => ({ | |
| 1900 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), | |
| 1901 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) | |
| 1902 }) | |
| 1903 }); | |
| 1904 const _suffix = Symbol('_suffix'); | |
| 1905 src__string_matchers._StringEndsWith = class _StringEndsWith extends src__stri
ng_matchers._StringMatcher { | |
| 1906 new(suffix) { | |
| 1907 this[_suffix] = suffix; | |
| 1908 super.new(); | |
| 1909 } | |
| 1910 matches(item, matchState) { | |
| 1911 return typeof item == 'string' && dart.test(item[dartx.endsWith](this[_suf
fix])); | |
| 1912 } | |
| 1913 describe(description) { | |
| 1914 return description.add('a string ending with ').addDescriptionOf(this[_suf
fix]); | |
| 1915 } | |
| 1916 }; | |
| 1917 dart.setSignature(src__string_matchers._StringEndsWith, { | |
| 1918 constructors: () => ({new: dart.definiteFunctionType(src__string_matchers._S
tringEndsWith, [core.String])}), | |
| 1919 methods: () => ({ | |
| 1920 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), | |
| 1921 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) | |
| 1922 }) | |
| 1923 }); | |
| 1924 const _substrings = Symbol('_substrings'); | |
| 1925 src__string_matchers._StringContainsInOrder = class _StringContainsInOrder ext
ends src__string_matchers._StringMatcher { | |
| 1926 new(substrings) { | |
| 1927 this[_substrings] = substrings; | |
| 1928 super.new(); | |
| 1929 } | |
| 1930 matches(item, matchState) { | |
| 1931 if (!(typeof item == 'string')) { | |
| 1932 return false; | |
| 1933 } | |
| 1934 let from_index = 0; | |
| 1935 for (let s of this[_substrings]) { | |
| 1936 from_index = core.int._check(dart.dsend(item, 'indexOf', s, from_index))
; | |
| 1937 if (dart.notNull(from_index) < 0) return false; | |
| 1938 } | |
| 1939 return true; | |
| 1940 } | |
| 1941 describe(description) { | |
| 1942 return description.addAll('a string containing ', ', ', ' in order', this[
_substrings]); | |
| 1943 } | |
| 1944 }; | |
| 1945 dart.setSignature(src__string_matchers._StringContainsInOrder, { | |
| 1946 constructors: () => ({new: dart.definiteFunctionType(src__string_matchers._S
tringContainsInOrder, [core.List$(core.String)])}), | |
| 1947 methods: () => ({ | |
| 1948 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), | |
| 1949 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) | |
| 1950 }) | |
| 1951 }); | |
| 1952 const _regexp = Symbol('_regexp'); | |
| 1953 src__string_matchers._MatchesRegExp = class _MatchesRegExp extends src__string
_matchers._StringMatcher { | |
| 1954 new(re) { | |
| 1955 this[_regexp] = null; | |
| 1956 super.new(); | |
| 1957 if (typeof re == 'string') { | |
| 1958 this[_regexp] = core.RegExp.new(re); | |
| 1959 } else if (core.RegExp.is(re)) { | |
| 1960 this[_regexp] = re; | |
| 1961 } else { | |
| 1962 dart.throw(new core.ArgumentError('matches requires a regexp or string')
); | |
| 1963 } | |
| 1964 } | |
| 1965 matches(item, matchState) { | |
| 1966 return typeof item == 'string' ? this[_regexp].hasMatch(item) : false; | |
| 1967 } | |
| 1968 describe(description) { | |
| 1969 return description.add(dart.str`match '${this[_regexp].pattern}'`); | |
| 1970 } | |
| 1971 }; | |
| 1972 dart.setSignature(src__string_matchers._MatchesRegExp, { | |
| 1973 constructors: () => ({new: dart.definiteFunctionType(src__string_matchers._M
atchesRegExp, [dart.dynamic])}), | |
| 1974 methods: () => ({ | |
| 1975 matches: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Map]), | |
| 1976 describe: dart.definiteFunctionType(src__interfaces.Description, [src__int
erfaces.Description]) | |
| 1977 }) | |
| 1978 }); | |
| 1979 src__string_matchers._isWhitespace = function(ch) { | |
| 1980 return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t'; | |
| 1981 }; | |
| 1982 dart.fn(src__string_matchers._isWhitespace, StringTobool()); | |
| 1983 src__util._Predicate = dart.typedef('_Predicate', () => dart.functionType(core
.bool, [dart.dynamic])); | |
| 1984 src__util._escapeMap = dart.const(dart.map({'\n': '\\n', '\r': '\\r', '\f': '\
\f', '\b': '\\b', '\t': '\\t', '\v': '\\v', '': '\\x7F'})); | |
| 1985 dart.defineLazy(src__util, { | |
| 1986 get _escapeRegExp() { | |
| 1987 return core.RegExp.new(dart.str`[\\x00-\\x07\\x0E-\\x1F${src__util._escape
Map[dartx.keys][dartx.map](core.String)(src__util._getHexLiteral)[dartx.join]()}
]`); | |
| 1988 } | |
| 1989 }); | |
| 1990 src__util._getHexLiteral = function(input) { | |
| 1991 let rune = input[dartx.runes].single; | |
| 1992 return '\\x' + dart.notNull(rune[dartx.toRadixString](16)[dartx.toUpperCase]
()[dartx.padLeft](2, '0')); | |
| 1993 }; | |
| 1994 dart.fn(src__util._getHexLiteral, StringToString()); | |
| 1995 // Exports: | 1995 // Exports: |
| 1996 exports.matcher = matcher; | |
| 1997 exports.mirror_matchers = mirror_matchers; | 1996 exports.mirror_matchers = mirror_matchers; |
| 1998 exports.src__core_matchers = src__core_matchers; | 1997 exports.src__pretty_print = src__pretty_print; |
| 1999 exports.src__description = src__description; | |
| 2000 exports.src__error_matchers = src__error_matchers; | |
| 2001 exports.src__interfaces = src__interfaces; | |
| 2002 exports.src__iterable_matchers = src__iterable_matchers; | 1998 exports.src__iterable_matchers = src__iterable_matchers; |
| 2003 exports.src__map_matchers = src__map_matchers; | 1999 exports.src__map_matchers = src__map_matchers; |
| 2000 exports.src__error_matchers = src__error_matchers; |
| 2001 exports.src__description = src__description; |
| 2002 exports.src__util = src__util; |
| 2003 exports.src__operator_matchers = src__operator_matchers; |
| 2004 exports.src__interfaces = src__interfaces; |
| 2005 exports.src__string_matchers = src__string_matchers; |
| 2006 exports.src__core_matchers = src__core_matchers; |
| 2004 exports.src__numeric_matchers = src__numeric_matchers; | 2007 exports.src__numeric_matchers = src__numeric_matchers; |
| 2005 exports.src__operator_matchers = src__operator_matchers; | 2008 exports.matcher = matcher; |
| 2006 exports.src__pretty_print = src__pretty_print; | |
| 2007 exports.src__string_matchers = src__string_matchers; | |
| 2008 exports.src__util = src__util; | |
| 2009 }); | 2009 }); |
| OLD | NEW |