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

Side by Side Diff: pkg/analysis_server/test/computer/error_test.dart

Issue 479683005: 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 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.computer.error; 5 library test.computer.error;
6 6
7 import 'package:analysis_server/src/computer/error.dart'; 7 import 'package:analysis_server/src/computer/error.dart';
8 import 'package:analysis_server/src/protocol2.dart'; 8 import 'package:analysis_server/src/protocol2.dart';
9 import 'package:analysis_server/src/constants.dart'; 9 import 'package:analysis_server/src/constants.dart';
10 import 'package:analysis_testing/mocks.dart'; 10 import 'package:analysis_testing/mocks.dart';
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 FILE: 'foo.dart', 97 FILE: 'foo.dart',
98 OFFSET: 10, 98 OFFSET: 10,
99 LENGTH: 20, 99 LENGTH: 20,
100 START_LINE: -1, 100 START_LINE: -1,
101 START_COLUMN: -1 101 START_COLUMN: -1
102 }, 102 },
103 MESSAGE: 'my message' 103 MESSAGE: 'my message'
104 }); 104 });
105 } 105 }
106 106
107 void test_fromJson() {
108 var json = {
109 SEVERITY: 'ERROR',
110 TYPE: 'SYNTACTIC_ERROR',
111 LOCATION: {
112 FILE: '/test.dart',
113 OFFSET: 19,
114 LENGTH: 1,
115 START_LINE: 2,
116 START_COLUMN: 11
117 },
118 MESSAGE: 'Expected to find \';\'',
119 CORRECTION: 'my correction'
120 };
121 AnalysisError error =
122 new AnalysisError.fromJson(new ResponseDecoder(), 'json', json);
123 {
124 Location location = error.location;
125 expect(location.file, '/test.dart');
126 expect(location.offset, 19);
127 expect(location.length, 1);
128 expect(location.startLine, 2);
129 expect(location.startColumn, 11);
130 }
131 expect(error.message, "Expected to find ';'");
132 expect(error.severity, ErrorSeverity.ERROR);
133 expect(error.type, ErrorType.SYNTACTIC_ERROR);
134 expect(error.correction, "my correction");
135 }
136
137 void test_engineErrorsToJson() { 107 void test_engineErrorsToJson() {
138 var json = engineErrorsToJson(lineInfo, [engineError]); 108 var json = engineErrorsToJson(lineInfo, [engineError]);
139 expect(json, unorderedEquals([{ 109 expect(json, unorderedEquals([{
140 'severity': 'ERROR', 110 'severity': 'ERROR',
141 'type': 'COMPILE_TIME_ERROR', 111 'type': 'COMPILE_TIME_ERROR',
142 'location': { 112 'location': {
143 'file': 'foo.dart', 113 'file': 'foo.dart',
144 'offset': 10, 114 'offset': 10,
145 'length': 20, 115 'length': 20,
146 'startLine': 3, 116 'startLine': 3,
147 'startColumn': 2 117 'startColumn': 2
148 }, 118 },
149 'message': 'my message' 119 'message': 'my message'
150 }])); 120 }]));
151 } 121 }
152 } 122 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698