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

Unified Diff: pkg/analysis_server/test/protocol_test.dart

Issue 497393002: Make more use of generated code in analysis server. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: pkg/analysis_server/test/protocol_test.dart
diff --git a/pkg/analysis_server/test/protocol_test.dart b/pkg/analysis_server/test/protocol_test.dart
index 76768b9d127d65b744d094f3d478ebb190541b23..33f8ba85e098a856c00f0e5126a7f187854255a0 100644
--- a/pkg/analysis_server/test/protocol_test.dart
+++ b/pkg/analysis_server/test/protocol_test.dart
@@ -59,8 +59,7 @@ class NotificationTest {
Notification original = new Notification('foo');
Notification notification = new Notification.fromJson(original.toJson());
expect(notification.event, equals('foo'));
- expect(notification.params.length, equals(0));
- expect(notification.getParameter('x'), isNull);
+ expect(notification.params, isNull);
}
void test_fromJson_withParams() {
@@ -68,16 +67,14 @@ class NotificationTest {
original.setParameter('x', 'y');
Notification notification = new Notification.fromJson(original.toJson());
expect(notification.event, equals('foo'));
- expect(notification.params.length, equals(1));
- expect(notification.getParameter('x'), equals('y'));
+ expect(notification.params, equals({'x': 'y'}));
}
- void test_getParameter_defined() {
+ void test_toJson_withParams() {
Notification notification = new Notification('foo');
notification.setParameter('x', 'y');
expect(notification.event, equals('foo'));
- expect(notification.params.length, equals(1));
- expect(notification.getParameter('x'), equals('y'));
+ expect(notification.params, equals({'x': 'y'}));
expect(notification.toJson(), equals({
'event': 'foo',
'params': {
@@ -86,11 +83,10 @@ class NotificationTest {
}));
}
- void test_getParameter_undefined() {
+ void test_toJson_noParams() {
Notification notification = new Notification('foo');
expect(notification.event, equals('foo'));
- expect(notification.params.length, equals(0));
- expect(notification.getParameter('x'), isNull);
+ expect(notification.params, isNull);
expect(notification.toJson(), equals({
'event': 'foo'
}));
@@ -371,26 +367,11 @@ class ResponseTest {
}
void test_fromJson_withResult() {
- Response original = new Response('myId');
- original.setResult('foo', 'bar');
+ Response original = new Response('myId', result: {'foo': 'bar'});
Response response = new Response.fromJson(original.toJson());
expect(response.id, equals('myId'));
Map<String, Object> result = response.result;
expect(result.length, equals(1));
expect(result['foo'], equals('bar'));
}
-
- void test_setResult() {
- String resultName = 'name';
- String resultValue = 'value';
- Response response = new Response('0');
- response.setResult(resultName, resultValue);
- expect(response.result[resultName], same(resultValue));
- expect(response.toJson(), equals({
- Response.ID: '0',
- Response.RESULT: {
- resultName: resultValue
- }
- }));
- }
}

Powered by Google App Engine
This is Rietveld 408576698