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

Side by Side Diff: pkg/matcher/test/pretty_print_minified_test.dart

Issue 208823005: pkg/matcher (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: nit Created 6 years, 9 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/matcher/test/mirror_matchers_test.dart ('k') | pkg/matcher/test/pretty_print_test.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 // This file is for pretty-print tests that rely on the names of various Dart 5 // This file is for pretty-print tests that rely on the names of various Dart
6 // types. These tests normally fail when run in minified dart2js, since the 6 // types. These tests normally fail when run in minified dart2js, since the
7 // names will be mangled. This version of the file is modified to expect 7 // names will be mangled. This version of the file is modified to expect
8 // minified names. 8 // minified names.
9 9
10 import 'dart:collection'; 10 import 'dart:collection';
11 11
12 import 'package:unittest/src/pretty_print.dart'; 12 import 'package:unittest/unittest.dart' as ut;
13 import 'package:unittest/unittest.dart'; 13
14 import 'package:matcher/matcher.dart';
15 import 'package:matcher/src/pretty_print.dart';
14 16
15 class DefaultToString {} 17 class DefaultToString {}
16 18
17 class CustomToString { 19 class CustomToString {
18 String toString() => "string representation"; 20 String toString() => "string representation";
19 } 21 }
20 22
21 class _PrivateName { 23 class _PrivateName {
22 String toString() => "string representation"; 24 String toString() => "string representation";
23 } 25 }
24 26
25 class _PrivateNameIterable extends IterableMixin { 27 class _PrivateNameIterable extends IterableMixin {
26 Iterator get iterator => [1, 2, 3].iterator; 28 Iterator get iterator => [1, 2, 3].iterator;
27 } 29 }
28 30
29 // A regexp fragment matching a minified name. 31 // A regexp fragment matching a minified name.
30 final _minifiedName = r"[A-Za-z0-9]{1,3}"; 32 final _minifiedName = r"[A-Za-z0-9]{1,3}";
31 33
32 void main() { 34 void main() {
33 group('with an object', () { 35 ut.group('with an object', () {
34 test('with a default [toString]', () { 36 ut.test('with a default [toString]', () {
35 expect(prettyPrint(new DefaultToString()), 37 expect(prettyPrint(new DefaultToString()),
36 matches(r"<Instance of '" + _minifiedName + r"'>")); 38 matches(r"<Instance of '" + _minifiedName + r"'>"));
37 }); 39 });
38 40
39 test('with a custom [toString]', () { 41 ut.test('with a custom [toString]', () {
40 expect(prettyPrint(new CustomToString()), 42 expect(prettyPrint(new CustomToString()),
41 matches(_minifiedName + r':<string representation>')); 43 matches(_minifiedName + r':<string representation>'));
42 }); 44 });
43 45
44 test('with a custom [toString] and a private name', () { 46 ut.test('with a custom [toString] and a private name', () {
45 expect(prettyPrint(new _PrivateName()), 47 expect(prettyPrint(new _PrivateName()),
46 matches(_minifiedName + r':<string representation>')); 48 matches(_minifiedName + r':<string representation>'));
47 }); 49 });
48 }); 50 });
49 51
50 group('with an iterable', () { 52 ut.group('with an iterable', () {
51 test("that's not a list", () { 53 ut.test("that's not a list", () {
52 expect(prettyPrint([1, 2, 3, 4].map((n) => n * 2)), 54 expect(prettyPrint([1, 2, 3, 4].map((n) => n * 2)),
53 matches(_minifiedName + r":\[2, 4, 6, 8\]")); 55 matches(_minifiedName + r":\[2, 4, 6, 8\]"));
54 }); 56 });
55 57
56 test("that's not a list and has a private name", () { 58 ut.test("that's not a list and has a private name", () {
57 expect(prettyPrint(new _PrivateNameIterable()), 59 expect(prettyPrint(new _PrivateNameIterable()),
58 matches(_minifiedName + r":\[1, 2, 3\]")); 60 matches(_minifiedName + r":\[1, 2, 3\]"));
59 }); 61 });
60 }); 62 });
61 } 63 }
OLDNEW
« no previous file with comments | « pkg/matcher/test/mirror_matchers_test.dart ('k') | pkg/matcher/test/pretty_print_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698