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

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

Issue 337943002: Adjust server for API changes (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixed bug Created 6 years, 6 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
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 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 @runTest 382 @runTest
383 static void asInt() { 383 static void asInt() {
384 setUp(); 384 setUp();
385 expect(makeDatum(1).asInt(), equals(1)); 385 expect(makeDatum(1).asInt(), equals(1));
386 expect(makeDatum('2').asInt(), equals(2)); 386 expect(makeDatum('2').asInt(), equals(2));
387 expect(() => makeDatum('xxx').asInt(), _throwsInvalidParameter); 387 expect(() => makeDatum('xxx').asInt(), _throwsInvalidParameter);
388 expect(() => makeDatum(true).asInt(), _throwsInvalidParameter); 388 expect(() => makeDatum(true).asInt(), _throwsInvalidParameter);
389 } 389 }
390 390
391 @runTest 391 @runTest
392 static void asList_nonList() {
393 setUp();
394 expect(() => makeDatum(3).asList((datum) => null), _throwsInvalidParameter);
395 }
396
397 @runTest
398 static void asList_emptyList() {
399 setUp();
400 expect(makeDatum([]).asList((datum) => datum.asString()), equals([]));
401 }
402
403 @runTest
404 static void asList_nonEmptyList() {
405 setUp();
406 expect(makeDatum(['foo', 'bar']).asList((datum) => datum.asString()), equals (['foo', 'bar']));
407 }
408
409 @runTest
392 static void asString() { 410 static void asString() {
393 setUp(); 411 setUp();
394 expect(makeDatum('foo').asString(), equals('foo')); 412 expect(makeDatum('foo').asString(), equals('foo'));
395 expect(() => makeDatum(3).asString(), _throwsInvalidParameter); 413 expect(() => makeDatum(3).asString(), _throwsInvalidParameter);
396 } 414 }
397 415
398 @runTest 416 @runTest
399 static void asStringList() { 417 static void asStringList() {
400 setUp(); 418 setUp();
401 expect(makeDatum(['foo', 'bar']).asStringList(), equals(['foo', 'bar'])); 419 expect(makeDatum(['foo', 'bar']).asStringList(), equals(['foo', 'bar']));
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 original.setResult('foo', 'bar'); 566 original.setResult('foo', 'bar');
549 Response response = new Response.fromJson(original.toJson()); 567 Response response = new Response.fromJson(original.toJson());
550 expect(response.id, equals('myId')); 568 expect(response.id, equals('myId'));
551 Map<String, Object> result = response.result; 569 Map<String, Object> result = response.result;
552 expect(result.length, equals(1)); 570 expect(result.length, equals(1));
553 expect(result['foo'], equals('bar')); 571 expect(result['foo'], equals('bar'));
554 } 572 }
555 } 573 }
556 574
557 Matcher _throwsRequestFailure = throwsA(new isInstanceOf<RequestFailure>()); 575 Matcher _throwsRequestFailure = throwsA(new isInstanceOf<RequestFailure>());
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/domain_server_test.dart ('k') | pkg/analysis_server/test/socket_server_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698