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

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

Issue 11301046: Restructure pkg/unittest and pkg/webdriver to follow the pub conventions. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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/instance_test.dart ('k') | pkg/unittest/test/mock_regexp_negative_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('matcherTest'); 5 library unittestTests;
6 #import('../../../pkg/unittest/unittest.dart'); 6 import '../../../pkg/unittest/lib/unittest.dart';
7 #source('test_utils.dart'); 7 part 'test_utils.dart';
8 8
9 doesNotThrow() {} 9 doesNotThrow() {}
10 doesThrow() { throw 'X'; } 10 doesThrow() { throw 'X'; }
11 11
12 class PrefixMatcher extends BaseMatcher { 12 class PrefixMatcher extends BaseMatcher {
13 final String _prefix; 13 final String _prefix;
14 const PrefixMatcher(this._prefix); 14 const PrefixMatcher(this._prefix);
15 bool matches(item, MatchState matchState) { 15 bool matches(item, MatchState matchState) {
16 return item is String && 16 return item is String &&
17 (collapseWhitespace(item)).startsWith(collapseWhitespace(_prefix)); 17 (collapseWhitespace(item)).startsWith(collapseWhitespace(_prefix));
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 shouldPass(() { throw new IllegalJSRegExpException('',''); }, 119 shouldPass(() { throw new IllegalJSRegExpException('',''); },
120 throwsIllegalJSRegExpException); 120 throwsIllegalJSRegExpException);
121 shouldFail(() { throw new Exception(); }, 121 shouldFail(() { throw new Exception(); },
122 throwsIllegalJSRegExpException, 122 throwsIllegalJSRegExpException,
123 "Expected: throws an exception which matches IllegalJSRegExpException " 123 "Expected: throws an exception which matches IllegalJSRegExpException "
124 "but: exception <Exception> does not match " 124 "but: exception <Exception> does not match "
125 "IllegalJSRegExpException."); 125 "IllegalJSRegExpException.");
126 }); 126 });
127 127
128 test('throwsRangeError', () { 128 test('throwsRangeError', () {
129 shouldPass(() { throw new RangeError.value(0); }, 129 shouldPass(() { throw new RangeError(0); },
130 throwsRangeError); 130 throwsRangeError);
131 shouldFail(() { throw new Exception(); }, 131 shouldFail(() { throw new Exception(); },
132 throwsRangeError, 132 throwsRangeError,
133 "Expected: throws an exception which matches RangeError " 133 "Expected: throws an exception which matches RangeError "
134 "but: exception <Exception> does not match " 134 "but: exception <Exception> does not match RangeError.");
135 "RangeError.");
136 }); 135 });
137 136
138 test('throwsNoSuchMethodError', () { 137 test('throwsNoSuchMethodError', () {
139 shouldPass(() { throw new NoSuchMethodError(null, '', null); }, 138 shouldPass(() { throw new NoSuchMethodError(null, '', null); },
140 throwsNoSuchMethodError); 139 throwsNoSuchMethodError);
141 shouldFail(() { throw new Exception(); }, 140 shouldFail(() { throw new Exception(); },
142 throwsNoSuchMethodError, 141 throwsNoSuchMethodError,
143 "Expected: throws an exception which matches NoSuchMethodError " 142 "Expected: throws an exception which matches NoSuchMethodError "
144 "but: exception <Exception> does not match " 143 "but: exception <Exception> does not match "
145 "NoSuchMethodError."); 144 "NoSuchMethodError.");
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 var w = new Widget(); 536 var w = new Widget();
538 w.price = 10; 537 w.price = 10;
539 shouldPass(w, new HasPrice(greaterThan(0))); 538 shouldPass(w, new HasPrice(greaterThan(0)));
540 shouldFail(w, new HasPrice(greaterThan(10)), 539 shouldFail(w, new HasPrice(greaterThan(10)),
541 'Expected: Widget with a price that is a value greater than <10> ' 540 'Expected: Widget with a price that is a value greater than <10> '
542 'but: price was <10>.'); 541 'but: price was <10>.');
543 }); 542 });
544 }); 543 });
545 } 544 }
546 545
OLDNEW
« no previous file with comments | « pkg/unittest/test/instance_test.dart ('k') | pkg/unittest/test/mock_regexp_negative_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698