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

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

Issue 12221157: Our nice new mismatched type error messages are garbled by minification. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 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 | « no previous file | pkg/unittest/test/test_utils.dart » ('j') | 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 library unittestTests; 5 library unittestTests;
6 import 'package:unittest/unittest.dart'; 6 import 'package:unittest/unittest.dart';
7 import 'dart:async'; 7 import 'dart:async';
8 part 'test_utils.dart'; 8 part 'test_utils.dart';
9 9
10 doesNotThrow() {} 10 doesNotThrow() {}
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 b.add(0); 242 b.add(0);
243 shouldFail(b, hasLength(1), 243 shouldFail(b, hasLength(1),
244 "Expected: an object with length of <1> " 244 "Expected: an object with length of <1> "
245 "but: was <[0, 0]> with length of <2>."); 245 "but: was <[0, 0]> with length of <2>.");
246 shouldPass(b, hasLength(2)); 246 shouldPass(b, hasLength(2));
247 }); 247 });
248 248
249 test('type mismatch', () { 249 test('type mismatch', () {
250 var a = new DateTime.utc(2000); 250 var a = new DateTime.utc(2000);
251 var b = a.toString(); 251 var b = a.toString();
252 // We should get something like:
253 // Expected: '2000-01-01 00:00:00.000Z'
254 // but: expected String:'2000-01-01 00:00:00.000Z'
255 // but was DateTime:<2000-01-01 00:00:00.000Z>.
256 // However, if minification is applied, then the type names
257 // will be shortened to two letters. The key thing is that
258 // there will be a "but: expected" part in the middle;
259 // this only happens with type mismatches or mismatches
260 // inside container types.
252 shouldFail(a, equals(b), 261 shouldFail(a, equals(b),
253 "Expected: '2000-01-01 00:00:00.000Z' " 262 matches(new RegExp("^Expected.*but: expected .*but was.*\$")));
254 "but: expected String:'2000-01-01 00:00:00.000Z' "
255 "but was DateTime:<2000-01-01 00:00:00.000Z>.");
256 }); 263 });
257 }); 264 });
258 265
259 group('Numeric Matchers', () { 266 group('Numeric Matchers', () {
260 267
261 test('greaterThan', () { 268 test('greaterThan', () {
262 shouldPass(10, greaterThan(9)); 269 shouldPass(10, greaterThan(9));
263 shouldFail(9, greaterThan(10), 270 shouldFail(9, greaterThan(10),
264 "Expected: a value greater than <10> but: was <9>."); 271 "Expected: a value greater than <10> but: was <9>.");
265 }); 272 });
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 var w = new Widget(); 712 var w = new Widget();
706 w.price = 10; 713 w.price = 10;
707 shouldPass(w, new HasPrice(greaterThan(0))); 714 shouldPass(w, new HasPrice(greaterThan(0)));
708 shouldFail(w, new HasPrice(greaterThan(10)), 715 shouldFail(w, new HasPrice(greaterThan(10)),
709 'Expected: Widget with a price that is a value greater than <10> ' 716 'Expected: Widget with a price that is a value greater than <10> '
710 'but: price was <10>.'); 717 'but: price was <10>.');
711 }); 718 });
712 }); 719 });
713 } 720 }
714 721
OLDNEW
« no previous file with comments | « no previous file | pkg/unittest/test/test_utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698