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

Side by Side Diff: test/test_utils.dart

Issue 840133003: matcher: fixed status file, formatting, tweaks to readme (Closed) Base URL: https://github.com/dart-lang/matcher.git@master
Patch Set: nits Created 5 years, 11 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
« no previous file with comments | « test/test_common.dart ('k') | test/throws_matchers_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 library matcher.test_utils; 5 library matcher.test_utils;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:matcher/matcher.dart'; 9 import 'package:matcher/matcher.dart';
10 import 'package:unittest/unittest.dart' show test, expectAsync; 10 import 'package:unittest/unittest.dart' show test, expectAsync;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 expect(_errorCount, equals(0)); 58 expect(_errorCount, equals(0));
59 } 59 }
60 if (isAsync) { 60 if (isAsync) {
61 Timer.run(expectAsync(afterTest)); 61 Timer.run(expectAsync(afterTest));
62 } else { 62 } else {
63 afterTest(); 63 afterTest();
64 } 64 }
65 } 65 }
66 66
67 doesNotThrow() {} 67 doesNotThrow() {}
68 doesThrow() { throw 'X'; } 68 doesThrow() {
69 throw 'X';
70 }
69 71
70 class PrefixMatcher extends Matcher { 72 class PrefixMatcher extends Matcher {
71 final String _prefix; 73 final String _prefix;
72 const PrefixMatcher(this._prefix); 74 const PrefixMatcher(this._prefix);
73 bool matches(item, Map matchState) { 75 bool matches(item, Map matchState) {
74 return item is String && 76 return item is String &&
75 (collapseWhitespace(item)).startsWith(collapseWhitespace(_prefix)); 77 (collapseWhitespace(item)).startsWith(collapseWhitespace(_prefix));
76 } 78 }
77 79
78 Description describe(Description description) => 80 Description describe(Description description) => description
79 description.add('a string starting with '). 81 .add('a string starting with ')
80 addDescriptionOf(collapseWhitespace(_prefix)). 82 .addDescriptionOf(collapseWhitespace(_prefix))
81 add(' ignoring whitespace'); 83 .add(' ignoring whitespace');
82 } 84 }
OLDNEW
« no previous file with comments | « test/test_common.dart ('k') | test/throws_matchers_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698