@@ -6,7 +6,6 @@ import 'package:angular2/platform/testing/browser.dart';
66import 'package:angular2/src/core/linker/app_view_utils.dart' ;
77import 'package:angular2/src/core/reflection/reflection.dart' ;
88import 'package:angular2/src/core/reflection/reflection_capabilities.dart' ;
9- import 'package:matcher/matcher.dart' ;
109
1110import "internal_injector.dart" ;
1211
@@ -119,71 +118,4 @@ void setBaseTestProviders(
119118 testInjector.reset ();
120119}
121120
122- class _ThrowsWith extends Matcher {
123- // RegExp or String.
124- final expected;
125-
126- _ThrowsWith (this .expected) {
127- assert (expected is RegExp || expected is String );
128- }
129-
130- bool matches (item, Map matchState) {
131- if (item is ! Function ) return false ;
132-
133- try {
134- item ();
135- return false ;
136- } catch (e, s) {
137- var errorString = e.toString ();
138- if (expected is String && errorString.contains (expected)) {
139- return true ;
140- } else if (expected is RegExp && expected.hasMatch (errorString)) {
141- return true ;
142- } else {
143- addStateInfo (matchState, {'exception' : errorString, 'stack' : s});
144- return false ;
145- }
146- }
147- }
148-
149- Description describe (Description description) {
150- if (expected is String ) {
151- return description
152- .add ('throws an error with a toString() containing ' )
153- .addDescriptionOf (expected);
154- }
155-
156- assert (expected is RegExp );
157- return description
158- .add ('throws an error with a toString() matched with ' )
159- .addDescriptionOf (expected);
160- }
161-
162- Description describeMismatch (
163- item, Description mismatchDescription, Map matchState, bool verbose) {
164- if (item is ! Function ) {
165- return mismatchDescription.add ('is not a Function or Future' );
166- } else if (matchState['exception' ] == null ) {
167- return mismatchDescription.add ('did not throw' );
168- } else {
169- if (expected is String ) {
170- mismatchDescription
171- .add ('threw an error with a toString() containing ' )
172- .addDescriptionOf (matchState['exception' ]);
173- } else {
174- assert (expected is RegExp );
175- mismatchDescription
176- .add ('threw an error with a toString() matched with ' )
177- .addDescriptionOf (matchState['exception' ]);
178- }
179- if (verbose) {
180- mismatchDescription.add (' at ' ).add (matchState['stack' ].toString ());
181- }
182- return mismatchDescription;
183- }
184- }
185- }
186-
187- Matcher throwsWith (message) => new _ThrowsWith (message);
188-
189121TestInjector getTestInjector () => _testInjector;
0 commit comments