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

Side by Side Diff: pkg/unittest/test/matchers_test.dart

Issue 15755005: Change output of string equality match failures. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/unittest/lib/src/core_matchers.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'dart:async'; 5 import 'dart:async';
6 import 'dart:collection'; 6 import 'dart:collection';
7 7
8 import 'package:unittest/unittest.dart'; 8 import 'package:unittest/unittest.dart';
9 9
10 import 'test_common.dart'; 10 import 'test_common.dart';
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 shouldFail(a, containsValue('ba'), 499 shouldFail(a, containsValue('ba'),
500 "Expected: contains value 'ba' But: was {'foo': 'bar'}."); 500 "Expected: contains value 'ba' But: was {'foo': 'bar'}.");
501 }); 501 });
502 502
503 test('containsPair', () { 503 test('containsPair', () {
504 var a = new Map(); 504 var a = new Map();
505 a['foo'] = 'bar'; 505 a['foo'] = 'bar';
506 shouldPass(a, containsPair('foo', 'bar')); 506 shouldPass(a, containsPair('foo', 'bar'));
507 shouldFail(a, containsPair('foo', 'ba'), 507 shouldFail(a, containsPair('foo', 'ba'),
508 "Expected: contains pair 'foo' => 'ba' " 508 "Expected: contains pair 'foo' => 'ba' "
509 "But: contains key 'foo' but with value was 'bar'. " 509 "But: Strings are not equal. Both strings start the same, "
510 "but the given value also has the following trailing characters: r. "
510 "Actual: {'foo': 'bar'}"); 511 "Actual: {'foo': 'bar'}");
511 shouldFail(a, containsPair('fo', 'bar'), 512 shouldFail(a, containsPair('fo', 'bar'),
512 "Expected: contains pair 'fo' => 'bar' " 513 "Expected: contains pair 'fo' => 'bar' "
513 "But: doesn't contain key 'fo'. " 514 "But: doesn't contain key 'fo'. "
514 "Actual: {'foo': 'bar'}"); 515 "Actual: {'foo': 'bar'}");
515 }); 516 });
516 517
517 test('hasLength', () { 518 test('hasLength', () {
518 var a = new Map(); 519 var a = new Map();
519 a['foo'] = 'bar'; 520 a['foo'] = 'bar';
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 test('throwsA - correct error', () { 592 test('throwsA - correct error', () {
592 var completer = new Completer(); 593 var completer = new Completer();
593 completer.completeError('X'); 594 completer.completeError('X');
594 shouldPass(completer.future, throwsA(equals('X')), isAsync: true); 595 shouldPass(completer.future, throwsA(equals('X')), isAsync: true);
595 }); 596 });
596 597
597 test('throwsA - wrong error', () { 598 test('throwsA - wrong error', () {
598 var completer = new Completer(); 599 var completer = new Completer();
599 completer.completeError('X'); 600 completer.completeError('X');
600 shouldFail(completer.future, throwsA(equals('Y')), 601 shouldFail(completer.future, throwsA(equals('Y')),
601 "Expected: 'Y' But: was 'X'.", 602 "Expected: 'Y' But: Strings are not equal. "
603 "Expected: Y But was: XX ^ Differ at position 0. Actual: 'X'",
Siggi Cherem (dart-lang) 2013/05/22 23:09:42 I assume some \n and spaces are trimmed here? it w
602 isAsync: true); 604 isAsync: true);
603 }); 605 });
604 }); 606 });
605 607
606 group('Predicate Matchers', () { 608 group('Predicate Matchers', () {
607 test('isInstanceOf', () { 609 test('isInstanceOf', () {
608 shouldFail(0, predicate((x) => x is String, "an instance of String"), 610 shouldFail(0, predicate((x) => x is String, "an instance of String"),
609 "Expected: an instance of String But: was <0>."); 611 "Expected: an instance of String But: was <0>.");
610 shouldPass('cow', predicate((x) => x is String, "an instance of String")); 612 shouldPass('cow', predicate((x) => x is String, "an instance of String"));
611 }); 613 });
612 }); 614 });
613 } 615 }
614 616
OLDNEW
« no previous file with comments | « pkg/unittest/lib/src/core_matchers.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698