| Index: client/tests/client/dom/IndexedDB2Test.dart
|
| diff --git a/client/tests/client/dom/IndexedDB2Test.dart b/client/tests/client/dom/IndexedDB2Test.dart
|
| index 0c4baffa48af61cdd8188aa8d47bd1f2c76b4521..e877b94b31b85633c8e3da2aa03032d6b89b3f2d 100644
|
| --- a/client/tests/client/dom/IndexedDB2Test.dart
|
| +++ b/client/tests/client/dom/IndexedDB2Test.dart
|
| @@ -3,6 +3,7 @@
|
| #import('../../../../lib/unittest/dom_config.dart');
|
| #import('dart:dom');
|
| #import('dart:coreimpl');
|
| +#import('utils.dart');
|
|
|
| // Write and re-read Maps: simple Maps; Maps with DAGs; Maps with cycles.
|
|
|
| @@ -66,67 +67,6 @@ testReadWrite(key, value, check,
|
| };
|
|
|
|
|
| -/**
|
| - * Verifies that [actual] has the same graph structure as [expected].
|
| - * Detects cycles and DAG structure in Maps and Lists.
|
| - */
|
| -verifyGraph(expected, actual) {
|
| - var eItems = [];
|
| - var aItems = [];
|
| -
|
| - message(path, reason) => path == ''
|
| - ? reason
|
| - : reason == null ? "path: $path" : "path: $path, $reason";
|
| -
|
| - walk(path, expected, actual) {
|
| - if (expected is String || expected is num || expected == null) {
|
| - Expect.equals(expected, actual, message(path, 'not equal'));
|
| - return;
|
| - }
|
| -
|
| - // Cycle or DAG?
|
| - for (int i = 0; i < eItems.length; i++) {
|
| - if (expected === eItems[i]) {
|
| - Expect.identical(aItems[i], actual, message(path, 'back or side edge'));
|
| - return;
|
| - }
|
| - }
|
| - eItems.add(expected);
|
| - aItems.add(actual);
|
| -
|
| - if (expected is List) {
|
| - Expect.isTrue(actual is List, message(path, '$actual is List'));
|
| - Expect.equals(expected.length, actual.length,
|
| - message(path, 'different list lengths'));
|
| - for (var i = 0; i < expected.length; i++) {
|
| - walk('$path[$i]', expected[i], actual[i]);
|
| - }
|
| - return;
|
| - }
|
| -
|
| - if (expected is Map) {
|
| - Expect.isTrue(actual is Map, message(path, '$actual is Map'));
|
| - for (var key in expected.getKeys()) {
|
| - if (!actual.containsKey(key)) {
|
| - Expect.fail(message(path, 'missing key "$key"'));
|
| - }
|
| - walk('$path["$key"]', expected[key], actual[key]);
|
| - }
|
| - for (var key in actual.getKeys()) {
|
| - if (!expected.containsKey(key)) {
|
| - Expect.fail(message(path, 'extra key "$key"'));
|
| - }
|
| - }
|
| - return;
|
| - }
|
| -
|
| - Expect.fail('Unhandled type: $expected');
|
| - }
|
| -
|
| - walk('', expected, actual);
|
| -}
|
| -
|
| -
|
| tests_dynamic() {
|
| var obj1 = {'a': 100, 'b': 's'};
|
| var obj2 = {'x': obj1, 'y': obj1}; // DAG.
|
|
|