OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 test.protocol; | 5 library test.protocol; |
6 | 6 |
7 import 'dart:convert'; | 7 import 'dart:convert'; |
8 | 8 |
9 import 'package:analysis_server/plugin/protocol/protocol.dart'; | 9 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
10 import 'package:analysis_server/src/constants.dart'; | 10 import 'package:analysis_server/src/constants.dart'; |
11 import 'package:analysis_server/src/protocol/protocol_internal.dart'; | 11 import 'package:analysis_server/src/protocol/protocol_internal.dart'; |
| 12 import 'package:test/test.dart'; |
12 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 13 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
13 import 'package:unittest/unittest.dart'; | |
14 | 14 |
15 import 'utils.dart'; | 15 import 'utils.dart'; |
16 | 16 |
17 main() { | 17 main() { |
18 initializeTestEnvironment(); | 18 initializeTestEnvironment(); |
19 defineReflectiveTests(NotificationTest); | 19 defineReflectiveSuite(() { |
20 defineReflectiveTests(RequestTest); | 20 defineReflectiveTests(NotificationTest); |
21 defineReflectiveTests(RequestErrorTest); | 21 defineReflectiveTests(RequestTest); |
22 defineReflectiveTests(ResponseTest); | 22 defineReflectiveTests(RequestErrorTest); |
| 23 defineReflectiveTests(ResponseTest); |
| 24 }); |
23 } | 25 } |
24 | 26 |
25 Matcher _throwsRequestFailure = throwsA(new isInstanceOf<RequestFailure>()); | 27 Matcher _throwsRequestFailure = throwsA(new isInstanceOf<RequestFailure>()); |
26 | 28 |
27 @reflectiveTest | 29 @reflectiveTest |
28 class InvalidParameterResponseMatcher extends Matcher { | 30 class InvalidParameterResponseMatcher extends Matcher { |
29 static const String ERROR_CODE = 'INVALID_PARAMETER'; | 31 static const String ERROR_CODE = 'INVALID_PARAMETER'; |
30 | 32 |
31 @override | 33 @override |
32 Description describe(Description description) => | 34 Description describe(Description description) => |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 void test_fromJson_withResult() { | 267 void test_fromJson_withResult() { |
266 Response original = new Response('myId', result: {'foo': 'bar'}); | 268 Response original = new Response('myId', result: {'foo': 'bar'}); |
267 Response response = new Response.fromJson(original.toJson()); | 269 Response response = new Response.fromJson(original.toJson()); |
268 expect(response.id, equals('myId')); | 270 expect(response.id, equals('myId')); |
269 Map<String, Object> result = | 271 Map<String, Object> result = |
270 response.toJson()['result'] as Map<String, Object>; | 272 response.toJson()['result'] as Map<String, Object>; |
271 expect(result.length, equals(1)); | 273 expect(result.length, equals(1)); |
272 expect(result['foo'], equals('bar')); | 274 expect(result['foo'], equals('bar')); |
273 } | 275 } |
274 } | 276 } |
OLD | NEW |