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

Unified Diff: tests/html/utils.dart

Issue 11275054: Modified unittest to use new argument syntax. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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
Index: tests/html/utils.dart
===================================================================
--- tests/html/utils.dart (revision 14156)
+++ tests/html/utils.dart (working copy)
@@ -1,4 +1,5 @@
#library('TestUtils');
+#import('../../pkg/unittest/unittest.dart');
/**
* Verifies that [actual] has the same graph structure as [expected].
@@ -14,22 +15,22 @@
walk(path, expected, actual) {
if (expected is String || expected is num || expected == null) {
- Expect.equals(expected, actual, message(path, 'not equal'));
+ expect(actual, equals(expected), reason: 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, 'missing back or side edge'));
+ expect(actual, same(aItems[i]),
+ reason: message(path, 'missing back or side edge'));
return;
}
}
for (int i = 0; i < aItems.length; i++) {
if (actual === aItems[i]) {
- Expect.identical(eItems[i], expected,
- message(path, 'extra back or side edge'));
+ expect(expected, same(eItems[i]),
+ reason: message(path, 'extra back or side edge'));
return;
}
}
@@ -37,9 +38,9 @@
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'));
+ expect(actual, isList, reason: message(path, '$actual is List'));
+ expect(actual.length, expected.length,
+ reason: message(path, 'different list lengths'));
for (var i = 0; i < expected.length; i++) {
walk('$path[$i]', expected[i], actual[i]);
}
@@ -47,22 +48,22 @@
}
if (expected is Map) {
- Expect.isTrue(actual is Map, message(path, '$actual is Map'));
+ expect(actual, isMap, reason: message(path, '$actual is Map'));
for (var key in expected.keys) {
if (!actual.containsKey(key)) {
- Expect.fail(message(path, 'missing key "$key"'));
+ expect(false, isTrue, reason: message(path, 'missing key "$key"'));
}
walk('$path["$key"]', expected[key], actual[key]);
}
for (var key in actual.keys) {
if (!expected.containsKey(key)) {
- Expect.fail(message(path, 'extra key "$key"'));
+ expect(false, isTrue, reason: message(path, 'extra key "$key"'));
}
}
return;
}
- Expect.fail('Unhandled type: $expected');
+ expect(false, isTrue, reason: 'Unhandled type: $expected');
}
walk('', expected, actual);

Powered by Google App Engine
This is Rietveld 408576698