Chromium Code Reviews| Index: sdk/lib/_internal/pub/test/serve/utils.dart |
| diff --git a/sdk/lib/_internal/pub/test/serve/utils.dart b/sdk/lib/_internal/pub/test/serve/utils.dart |
| index 6c5f1ec0cde0fe120912728ca1175ac97bb7c2c4..bcff7e345394bd5b215aab323b173104f16547e6 100644 |
| --- a/sdk/lib/_internal/pub/test/serve/utils.dart |
| +++ b/sdk/lib/_internal/pub/test/serve/utils.dart |
| @@ -121,10 +121,20 @@ void endPubServe() { |
| /// Schedules an HTTP request to the running pub server with [urlPath] and |
| /// verifies that it responds with [expected]. |
| -void requestShouldSucceed(String urlPath, String expected) { |
| +void requestShouldSucceed(String urlPath, Pattern expected) { |
| + // RegExps are matched, everything else must be equal. Note that we can't use |
|
nweiz
2013/09/27 22:21:17
At this point, it's probably cleaner to make [expe
Bob Nystrom
2013/09/28 00:56:11
Most of the tests are testing for exact quality, a
nweiz
2013/09/30 17:33:34
Passing in a string will implicitly call [equals];
Bob Nystrom
2013/10/01 19:08:55
OK, done. I didn't do that before because I though
|
| + // matches() for a String because we want a String to mean "is exactly that" |
| + // where matches() implicitly converts it to a RegExp. |
| + var expectation; |
| + if (expected is RegExp) { |
| + expectation = matches(expected); |
| + } else { |
| + expectation = equals(expected); |
| + } |
| + |
| schedule(() { |
| return http.get("http://127.0.0.1:$_port/$urlPath").then((response) { |
| - expect(response.body, equals(expected)); |
| + expect(response.body, expectation); |
| }); |
| }, "request $urlPath"); |
| } |