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

Unified Diff: pkg/unittest/lib/src/core_matchers.dart

Issue 14367005: Improved error messages for type mismatches. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 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 | « no previous file | pkg/unittest/test/matchers_test.dart » ('j') | pkg/unittest/test/matchers_test.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/unittest/lib/src/core_matchers.dart
===================================================================
--- pkg/unittest/lib/src/core_matchers.dart (revision 21707)
+++ pkg/unittest/lib/src/core_matchers.dart (working copy)
@@ -177,9 +177,8 @@
var aType = typeName(actual);
var includeTypes = eType != aType;
// If we have recursed, show the expected value too; if not,
- // expect() will show it for us. As expect will not show type
- // mismatches at the top level we handle those here too.
- if (includeTypes || depth > 1) {
+ // expect() will show it for us.
+ if (depth > 0) {
reason.add('expected ');
if (includeTypes) {
reason.add(eType).add(':');
@@ -191,6 +190,9 @@
reason.add(aType).add(':');
}
reason.addDescriptionOf(actual);
+ if (includeTypes && depth == 0) {
+ reason.add(' (not type ').add(eType).add(')');
+ }
}
}
if (reason != null && location.length > 0) {
« no previous file with comments | « no previous file | pkg/unittest/test/matchers_test.dart » ('j') | pkg/unittest/test/matchers_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698