| 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/src/protocol.dart'; | 9 import 'package:analysis_server/src/protocol.dart'; |
| 10 import 'package:unittest/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 | 450 |
| 451 @runTest | 451 @runTest |
| 452 static void setResult() { | 452 static void setResult() { |
| 453 String resultName = 'name'; | 453 String resultName = 'name'; |
| 454 String resultValue = 'value'; | 454 String resultValue = 'value'; |
| 455 Response response = new Response('0'); | 455 Response response = new Response('0'); |
| 456 response.setResult(resultName, resultValue); | 456 response.setResult(resultName, resultValue); |
| 457 expect(response.getResult(resultName), same(resultValue)); | 457 expect(response.getResult(resultName), same(resultValue)); |
| 458 expect(response.toJson(), equals({ | 458 expect(response.toJson(), equals({ |
| 459 Response.ID: '0', | 459 Response.ID: '0', |
| 460 Response.ERROR: null, | |
| 461 Response.RESULT: { | 460 Response.RESULT: { |
| 462 resultName: resultValue | 461 resultName: resultValue |
| 463 } | 462 } |
| 464 })); | 463 })); |
| 465 } | 464 } |
| 466 | 465 |
| 467 @runTest | 466 @runTest |
| 468 static void fromJson() { | 467 static void fromJson() { |
| 469 Response original = new Response('myId'); | 468 Response original = new Response('myId'); |
| 470 Response response = new Response.fromJson(original.toJson()); | 469 Response response = new Response.fromJson(original.toJson()); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 488 original.setResult('foo', 'bar'); | 487 original.setResult('foo', 'bar'); |
| 489 Response response = new Response.fromJson(original.toJson()); | 488 Response response = new Response.fromJson(original.toJson()); |
| 490 expect(response.id, equals('myId')); | 489 expect(response.id, equals('myId')); |
| 491 Map<String, Object> result = response.result; | 490 Map<String, Object> result = response.result; |
| 492 expect(result.length, equals(1)); | 491 expect(result.length, equals(1)); |
| 493 expect(result['foo'], equals('bar')); | 492 expect(result['foo'], equals('bar')); |
| 494 } | 493 } |
| 495 } | 494 } |
| 496 | 495 |
| 497 Matcher _throwsRequestFailure = throwsA(new isInstanceOf<RequestFailure>()); | 496 Matcher _throwsRequestFailure = throwsA(new isInstanceOf<RequestFailure>()); |
| OLD | NEW |