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

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

Issue 807193003: Re-apply "Remove unittest and matcher from the repo." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 6 years 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/test_utils.dart ('k') | pkg/pkg.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 library matcher.core_matchers_test;
6
7 import 'package:matcher/matcher.dart';
8 import 'package:unittest/unittest.dart' show test, group;
9
10 import 'test_utils.dart';
11
12 void main() {
13 initUtils();
14
15
16 test('throws', () {
17 shouldFail(doesNotThrow, throws,
18 matches(
19 r"Expected: throws"
20 r" Actual: <Closure(: \(\) => dynamic "
21 r"from Function 'doesNotThrow': static\.)?>"
22 r" Which: did not throw"));
23 shouldPass(doesThrow, throws);
24 shouldFail(true, throws,
25 "Expected: throws"
26 " Actual: <true>"
27 " Which: is not a Function or Future");
28 });
29
30 test('throwsA', () {
31 shouldPass(doesThrow, throwsA(equals('X')));
32 shouldFail(doesThrow, throwsA(equals('Y')),
33 matches(
34 r"Expected: throws 'Y'"
35 r" Actual: <Closure(: \(\) => dynamic "
36 r"from Function 'doesThrow': static\.)?>"
37 r" Which: threw 'X'"));
38 });
39
40 test('throwsA', () {
41 shouldPass(doesThrow, throwsA(equals('X')));
42 shouldFail(doesThrow, throwsA(equals('Y')),
43 matches("Expected: throws 'Y'.*"
44 "Actual: <Closure.*"
45 "Which: threw 'X'"));
46 });
47
48
49 group('exception/error matchers', () {
50 test('throwsCyclicInitializationError', () {
51 expect(() => _Bicycle.foo, throwsCyclicInitializationError);
52 });
53
54 test('throwsConcurrentModificationError', () {
55 expect(() {
56 var a = { 'foo': 'bar' };
57 for (var k in a.keys) {
58 a.remove(k);
59 }
60 }, throwsConcurrentModificationError);
61 });
62
63 test('throwsNullThrownError', () {
64 expect(() => throw null, throwsNullThrownError);
65 });
66 });
67 }
68
69 class _Bicycle {
70 static final foo = bar();
71
72 static bar() {
73 return foo + 1;
74 }
75 }
76
OLDNEW
« no previous file with comments | « pkg/matcher/test/test_utils.dart ('k') | pkg/pkg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698