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

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

Issue 17904009: Hide parent function name in name of closurized function to user. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 5 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/test/matchers_test.dart ('k') | pkg/unittest/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 matcher tests that rely on the names of various Dart types. 5 // This file is for matcher tests that rely on the names of various Dart types.
6 // These tests will fail when run in minified dart2js, since the names will be 6 // These tests will fail when run in minified dart2js, since the names will be
7 // mangled. A version of this file that works in minified dart2js is in 7 // mangled. A version of this file that works in minified dart2js is in
8 // matchers_minified_test.dart. 8 // matchers_minified_test.dart.
9 9
10 import 'package:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
11 11
12 import 'test_common.dart'; 12 import 'test_common.dart';
13 import 'test_utils.dart'; 13 import 'test_utils.dart';
14 14
15 void main() { 15 void main() {
16 initUtils(); 16 initUtils();
17 17
18 group('Core matchers', () { 18 group('Core matchers', () {
19 test('throwsFormatException', () { 19 test('throwsFormatException', () {
20 shouldPass(() { throw new FormatException(''); }, 20 shouldPass(() { throw new FormatException(''); },
21 throwsFormatException); 21 throwsFormatException);
22 shouldFail(() { throw new Exception(); }, 22 shouldFail(() { throw new Exception(); },
23 throwsFormatException, 23 throwsFormatException,
24 matches( 24 matches(
25 r"Expected: throws FormatException +" 25 r"Expected: throws FormatException +"
26 r"Actual: <Closure(: \(dynamic\) => dynamic)?> +" 26 r"Actual: <Closure(: \(\) => dynamic)?> +"
27 r"Which: threw \?:<Exception>")); 27 r"Which: threw \?:<Exception>"));
28 28
29 }); 29 });
30 30
31 test('throwsArgumentError', () { 31 test('throwsArgumentError', () {
32 shouldPass(() { throw new ArgumentError(''); }, 32 shouldPass(() { throw new ArgumentError(''); },
33 throwsArgumentError); 33 throwsArgumentError);
34 shouldFail(() { throw new Exception(); }, 34 shouldFail(() { throw new Exception(); },
35 throwsArgumentError, 35 throwsArgumentError,
36 matches( 36 matches(
37 r"Expected: throws ArgumentError +" 37 r"Expected: throws ArgumentError +"
38 r"Actual: <Closure(: \(dynamic\) => dynamic)?> +" 38 r"Actual: <Closure(: \(\) => dynamic)?> +"
39 r"Which: threw \?:<Exception>")); 39 r"Which: threw \?:<Exception>"));
40 }); 40 });
41 41
42 test('throwsRangeError', () { 42 test('throwsRangeError', () {
43 shouldPass(() { throw new RangeError(0); }, 43 shouldPass(() { throw new RangeError(0); },
44 throwsRangeError); 44 throwsRangeError);
45 shouldFail(() { throw new Exception(); }, 45 shouldFail(() { throw new Exception(); },
46 throwsRangeError, 46 throwsRangeError,
47 matches( 47 matches(
48 r"Expected: throws RangeError +" 48 r"Expected: throws RangeError +"
49 r"Actual: <Closure(: \(dynamic\) => dynamic)?> +" 49 r"Actual: <Closure(: \(\) => dynamic)?> +"
50 r"Which: threw \?:<Exception>")); 50 r"Which: threw \?:<Exception>"));
51 }); 51 });
52 52
53 test('throwsNoSuchMethodError', () { 53 test('throwsNoSuchMethodError', () {
54 shouldPass(() { throw new NoSuchMethodError(null, '', null, null); }, 54 shouldPass(() { throw new NoSuchMethodError(null, '', null, null); },
55 throwsNoSuchMethodError); 55 throwsNoSuchMethodError);
56 shouldFail(() { throw new Exception(); }, 56 shouldFail(() { throw new Exception(); },
57 throwsNoSuchMethodError, 57 throwsNoSuchMethodError,
58 matches( 58 matches(
59 r"Expected: throws NoSuchMethodError +" 59 r"Expected: throws NoSuchMethodError +"
60 r"Actual: <Closure(: \(dynamic\) => dynamic)?> +" 60 r"Actual: <Closure(: \(\) => dynamic)?> +"
61 r"Which: threw \?:<Exception>")); 61 r"Which: threw \?:<Exception>"));
62 }); 62 });
63 63
64 test('throwsUnimplementedError', () { 64 test('throwsUnimplementedError', () {
65 shouldPass(() { throw new UnimplementedError(''); }, 65 shouldPass(() { throw new UnimplementedError(''); },
66 throwsUnimplementedError); 66 throwsUnimplementedError);
67 shouldFail(() { throw new Exception(); }, 67 shouldFail(() { throw new Exception(); },
68 throwsUnimplementedError, 68 throwsUnimplementedError,
69 matches( 69 matches(
70 r"Expected: throws UnimplementedError +" 70 r"Expected: throws UnimplementedError +"
71 r"Actual: <Closure(: \(dynamic\) => dynamic)?> +" 71 r"Actual: <Closure(: \(\) => dynamic)?> +"
72 r"Which: threw \?:<Exception>")); 72 r"Which: threw \?:<Exception>"));
73 }); 73 });
74 74
75 test('throwsUnsupportedError', () { 75 test('throwsUnsupportedError', () {
76 shouldPass(() { throw new UnsupportedError(''); }, 76 shouldPass(() { throw new UnsupportedError(''); },
77 throwsUnsupportedError); 77 throwsUnsupportedError);
78 shouldFail(() { throw new Exception(); }, 78 shouldFail(() { throw new Exception(); },
79 throwsUnsupportedError, 79 throwsUnsupportedError,
80 matches( 80 matches(
81 r"Expected: throws UnsupportedError +" 81 r"Expected: throws UnsupportedError +"
82 r"Actual: <Closure(: \(dynamic\) => dynamic)?> +" 82 r"Actual: <Closure(: \(\) => dynamic)?> +"
83 r"Which: threw \?:<Exception>")); 83 r"Which: threw \?:<Exception>"));
84 }); 84 });
85 85
86 test('throwsStateError', () { 86 test('throwsStateError', () {
87 shouldPass(() { throw new StateError(''); }, 87 shouldPass(() { throw new StateError(''); },
88 throwsStateError); 88 throwsStateError);
89 shouldFail(() { throw new Exception(); }, 89 shouldFail(() { throw new Exception(); },
90 throwsStateError, 90 throwsStateError,
91 matches( 91 matches(
92 r"Expected: throws StateError +" 92 r"Expected: throws StateError +"
93 r"Actual: <Closure(: \(dynamic\) => dynamic)?> +" 93 r"Actual: <Closure(: \(\) => dynamic)?> +"
94 r"Which: threw \?:<Exception>")); 94 r"Which: threw \?:<Exception>"));
95 }); 95 });
96 }); 96 });
97 97
98 group('Iterable Matchers', () { 98 group('Iterable Matchers', () {
99 test('isEmpty', () { 99 test('isEmpty', () {
100 var d = new SimpleIterable(0); 100 var d = new SimpleIterable(0);
101 var e = new SimpleIterable(1); 101 var e = new SimpleIterable(1);
102 shouldPass(d, isEmpty); 102 shouldPass(d, isEmpty);
103 shouldFail(e, isEmpty, "Expected: empty " 103 shouldFail(e, isEmpty, "Expected: empty "
(...skipping 16 matching lines...) Expand all
120 shouldPass(w, new HasPrice(10)); 120 shouldPass(w, new HasPrice(10));
121 shouldPass(w, new HasPrice(greaterThan(0))); 121 shouldPass(w, new HasPrice(greaterThan(0)));
122 shouldFail(w, new HasPrice(greaterThan(10)), 122 shouldFail(w, new HasPrice(greaterThan(10)),
123 "Expected: Widget with a price that is a value greater than <10> " 123 "Expected: Widget with a price that is a value greater than <10> "
124 "Actual: <Instance of 'Widget'> " 124 "Actual: <Instance of 'Widget'> "
125 "Which: has price with value <10> which is not " 125 "Which: has price with value <10> which is not "
126 "a value greater than <10>"); 126 "a value greater than <10>");
127 }); 127 });
128 }); 128 });
129 } 129 }
OLDNEW
« no previous file with comments | « pkg/unittest/test/matchers_test.dart ('k') | pkg/unittest/test/pretty_print_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698