OLD | NEW |
1 dart_library.library('expect', null, /* Imports */[ | 1 dart_library.library('expect', null, /* Imports */[ |
2 'dart/_runtime', | 2 'dart/_runtime', |
3 'dart/core' | 3 'dart/core' |
4 ], /* Lazy imports */[ | 4 ], /* Lazy imports */[ |
5 ], function(exports, dart, core) { | 5 ], function(exports, dart, core) { |
6 'use strict'; | 6 'use strict'; |
7 let dartx = dart.dartx; | 7 let dartx = dart.dartx; |
8 class Expect extends core.Object { | 8 class Expect extends core.Object { |
9 static _truncateString(string, start, end, length) { | 9 static _truncateString(string, start, end, length) { |
10 if (dart.notNull(end) - dart.notNull(start) > dart.notNull(length)) { | 10 if (dart.notNull(end) - dart.notNull(start) > dart.notNull(length)) { |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 Expect._fail(`Expect.listEquals(at index ${i}, ` + `expected: <${expec
ted[dartx.get](i)}>, actual: <${actual[dartx.get](i)}>${msg}) fails`); | 121 Expect._fail(`Expect.listEquals(at index ${i}, ` + `expected: <${expec
ted[dartx.get](i)}>, actual: <${actual[dartx.get](i)}>${msg}) fails`); |
122 } | 122 } |
123 } | 123 } |
124 if (expected[dartx.length] != actual[dartx.length]) { | 124 if (expected[dartx.length] != actual[dartx.length]) { |
125 Expect._fail('Expect.listEquals(list length, ' + `expected: <${expected[
dartx.length]}>, actual: <${actual[dartx.length]}>${msg}) ` + 'fails: Next eleme
nt <' + `${dart.notNull(expected[dartx.length]) > dart.notNull(n) ? expected[dar
tx.get](n) : actual[dartx.get](n)}>`); | 125 Expect._fail('Expect.listEquals(list length, ' + `expected: <${expected[
dartx.length]}>, actual: <${actual[dartx.length]}>${msg}) ` + 'fails: Next eleme
nt <' + `${dart.notNull(expected[dartx.length]) > dart.notNull(n) ? expected[dar
tx.get](n) : actual[dartx.get](n)}>`); |
126 } | 126 } |
127 } | 127 } |
128 static mapEquals(expected, actual, reason) { | 128 static mapEquals(expected, actual, reason) { |
129 if (reason === void 0) reason = null; | 129 if (reason === void 0) reason = null; |
130 let msg = Expect._getMessage(reason); | 130 let msg = Expect._getMessage(reason); |
131 for (let key of expected.keys) { | 131 for (let key of expected[dartx.keys]) { |
132 if (!dart.notNull(actual.containsKey(key))) { | 132 if (!dart.notNull(actual[dartx.containsKey](key))) { |
133 Expect._fail(`Expect.mapEquals(missing expected key: <${key}>${msg}) f
ails`); | 133 Expect._fail(`Expect.mapEquals(missing expected key: <${key}>${msg}) f
ails`); |
134 } | 134 } |
135 Expect.equals(expected.get(key), actual.get(key)); | 135 Expect.equals(expected[dartx.get](key), actual[dartx.get](key)); |
136 } | 136 } |
137 for (let key of actual.keys) { | 137 for (let key of actual[dartx.keys]) { |
138 if (!dart.notNull(expected.containsKey(key))) { | 138 if (!dart.notNull(expected[dartx.containsKey](key))) { |
139 Expect._fail(`Expect.mapEquals(unexpected key: <${key}>${msg}) fails`)
; | 139 Expect._fail(`Expect.mapEquals(unexpected key: <${key}>${msg}) fails`)
; |
140 } | 140 } |
141 } | 141 } |
142 } | 142 } |
143 static stringEquals(expected, actual, reason) { | 143 static stringEquals(expected, actual, reason) { |
144 if (reason === void 0) reason = null; | 144 if (reason === void 0) reason = null; |
145 if (expected == actual) return; | 145 if (expected == actual) return; |
146 let msg = Expect._getMessage(reason); | 146 let msg = Expect._getMessage(reason); |
147 let defaultMessage = `Expect.stringEquals(expected: <${expected}>", <${act
ual}>${msg}) fails`; | 147 let defaultMessage = `Expect.stringEquals(expected: <${expected}>", <${act
ual}>${msg}) fails`; |
148 if (expected == null || actual == null) { | 148 if (expected == null || actual == null) { |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 dart.setSignature(AssumeDynamic, { | 297 dart.setSignature(AssumeDynamic, { |
298 constructors: () => ({AssumeDynamic: [AssumeDynamic, []]}) | 298 constructors: () => ({AssumeDynamic: [AssumeDynamic, []]}) |
299 }); | 299 }); |
300 // Exports: | 300 // Exports: |
301 exports.Expect = Expect; | 301 exports.Expect = Expect; |
302 exports.ExpectException = ExpectException; | 302 exports.ExpectException = ExpectException; |
303 exports.NoInline = NoInline; | 303 exports.NoInline = NoInline; |
304 exports.TrustTypeAnnotations = TrustTypeAnnotations; | 304 exports.TrustTypeAnnotations = TrustTypeAnnotations; |
305 exports.AssumeDynamic = AssumeDynamic; | 305 exports.AssumeDynamic = AssumeDynamic; |
306 }); | 306 }); |
OLD | NEW |