Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Unified Diff: pkg/dev_compiler/test/codegen_expected/expect.js

Issue 2413073002: Start cleaning up the HTML tests. (Closed)
Patch Set: Unfork expect.dart. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/dev_compiler/test/codegen/minitest.dart ('k') | pkg/dev_compiler/test/codegen_expected/minitest.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/dev_compiler/test/codegen_expected/expect.js
diff --git a/pkg/dev_compiler/test/codegen_expected/expect.js b/pkg/dev_compiler/test/codegen_expected/expect.js
index 7b7a7c4776acaa69b5a9c5ca0d450a9a968ad6fc..793ac41c3159a9dba87c5b7b66ba7c65775a636f 100644
--- a/pkg/dev_compiler/test/codegen_expected/expect.js
+++ b/pkg/dev_compiler/test/codegen_expected/expect.js
@@ -210,13 +210,18 @@ define(['dart_sdk'], function(dart_sdk) {
}
static deepEquals(expected, actual) {
if (dart.equals(expected, actual)) return;
- if (core.List.is(expected) && core.List.is(actual)) {
- let n = dart.notNull(expected[dartx.length]) < dart.notNull(actual[dartx.length]) ? expected[dartx.length] : actual[dartx.length];
- for (let i = 0; i < dart.notNull(n); i++) {
- expect.Expect.deepEquals(expected[dartx.get](i), actual[dartx.get](i));
+ if (typeof expected == 'string' && typeof actual == 'string') {
+ expect.Expect.stringEquals(expected, actual);
+ } else if (core.Iterable.is(expected) && core.Iterable.is(actual)) {
+ let expectedLength = expected[dartx.length];
+ let actualLength = actual[dartx.length];
+ let length = dart.notNull(expectedLength) < dart.notNull(actualLength) ? expectedLength : actualLength;
+ for (let i = 0; i < dart.notNull(length); i++) {
+ expect.Expect.deepEquals(expected[dartx.elementAt](i), actual[dartx.elementAt](i));
}
- if (expected[dartx.length] != actual[dartx.length]) {
- expect.Expect._fail('Expect.deepEquals(list length, ' + dart.str`expected: <${expected[dartx.length]}>, actual: <${actual[dartx.length]}>) ` + 'fails: Next element <' + dart.str`${dart.notNull(expected[dartx.length]) > dart.notNull(n) ? expected[dartx.get](n) : actual[dartx.get](n)}>`);
+ if (expectedLength != actualLength) {
+ let nextElement = (dart.notNull(expectedLength) > dart.notNull(length) ? expected : actual)[dartx.elementAt](length);
+ expect.Expect._fail('Expect.deepEquals(list length, ' + dart.str`expected: <${expectedLength}>, actual: <${actualLength}>) ` + dart.str`fails: Next element <${nextElement}>`);
}
} else if (core.Map.is(expected) && core.Map.is(actual)) {
for (let key of expected[dartx.keys]) {
@@ -230,10 +235,6 @@ define(['dart_sdk'], function(dart_sdk) {
expect.Expect._fail(dart.str`Expect.deepEquals(unexpected key: <${key}>) fails`);
}
}
- } else if (typeof expected == 'string' && typeof actual == 'string') {
- let stringDifference = expect.Expect._stringDifference(expected, actual);
- dart.assert(stringDifference != null);
- expect.Expect._fail(dart.str`Expect.deepEquals(${stringDifference}) fails.`);
} else {
expect.Expect._fail(dart.str`Expect.deepEquals(expected: <${expected}>, actual: <${actual}>) ` + "fails.");
}
« no previous file with comments | « pkg/dev_compiler/test/codegen/minitest.dart ('k') | pkg/dev_compiler/test/codegen_expected/minitest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698