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

Side by Side Diff: pkg/matcher/test/pretty_print_unminified_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/pretty_print_test.dart ('k') | pkg/matcher/test/test_common.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 will fail when run in minified dart2js, since the names 6 // types. These tests will fail when run in minified dart2js, since the names
7 // will be mangled. A version of this file that works in minified dart2js is in 7 // will be mangled. A version of this file that works in minified dart2js is in
8 // pretty_print_minified_test.dart. 8 // pretty_print_minified_test.dart.
9 9
10 import 'dart:collection'; 10 import 'dart:collection';
11 import 'package:unittest/unittest.dart' as ut;
11 12
12 import 'package:unittest/src/pretty_print.dart'; 13 import 'package:matcher/matcher.dart';
13 import 'package:unittest/unittest.dart'; 14 import 'package:matcher/src/pretty_print.dart';
14 15
15 class DefaultToString {} 16 class DefaultToString {}
16 17
17 class CustomToString { 18 class CustomToString {
18 String toString() => "string representation"; 19 String toString() => "string representation";
19 } 20 }
20 21
21 class _PrivateName { 22 class _PrivateName {
22 String toString() => "string representation"; 23 String toString() => "string representation";
23 } 24 }
24 25
25 class _PrivateNameIterable extends IterableMixin { 26 class _PrivateNameIterable extends IterableMixin {
26 Iterator get iterator => [1, 2, 3].iterator; 27 Iterator get iterator => [1, 2, 3].iterator;
27 } 28 }
28 29
29 void main() { 30 void main() {
30 group('with an object', () { 31 ut.group('with an object', () {
31 test('with a default [toString]', () { 32 ut.test('with a default [toString]', () {
32 expect(prettyPrint(new DefaultToString()), 33 expect(prettyPrint(new DefaultToString()),
33 equals("<Instance of 'DefaultToString'>")); 34 equals("<Instance of 'DefaultToString'>"));
34 }); 35 });
35 36
36 test('with a custom [toString]', () { 37 ut.test('with a custom [toString]', () {
37 expect(prettyPrint(new CustomToString()), 38 expect(prettyPrint(new CustomToString()),
38 equals('CustomToString:<string representation>')); 39 equals('CustomToString:<string representation>'));
39 }); 40 });
40 41
41 test('with a custom [toString] and a private name', () { 42 ut.test('with a custom [toString] and a private name', () {
42 expect(prettyPrint(new _PrivateName()), 43 expect(prettyPrint(new _PrivateName()),
43 equals('?:<string representation>')); 44 equals('?:<string representation>'));
44 }); 45 });
45 }); 46 });
46 47
47 group('with an iterable', () { 48 ut.group('with an iterable', () {
48 test("that's not a list", () { 49 ut.test("that's not a list", () {
49 expect(prettyPrint([1, 2, 3, 4].map((n) => n * 2)), 50 expect(prettyPrint([1, 2, 3, 4].map((n) => n * 2)),
50 equals("MappedListIterable:[2, 4, 6, 8]")); 51 equals("MappedListIterable:[2, 4, 6, 8]"));
51 }); 52 });
52 53
53 test("that's not a list and has a private name", () { 54 ut.test("that's not a list and has a private name", () {
54 expect(prettyPrint(new _PrivateNameIterable()), 55 expect(prettyPrint(new _PrivateNameIterable()),
55 equals("?:[1, 2, 3]")); 56 equals("?:[1, 2, 3]"));
56 }); 57 });
57 }); 58 });
58 } 59 }
OLDNEW
« no previous file with comments | « pkg/matcher/test/pretty_print_test.dart ('k') | pkg/matcher/test/test_common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698