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

Side by Side Diff: pkg/analysis_server/test/protocol_test.dart

Issue 282993002: Leave "error" key out of response JSON when there is no error. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 months 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/analysis_server/test/domain_server_test.dart ('k') | no next file » | 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) 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
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
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>());
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/domain_server_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698