| 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.analysis_server; | 5 library test.analysis_server; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analyzer/src/generated/engine.dart'; | 9 import 'package:analyzer/src/generated/engine.dart'; |
| 10 import 'package:analyzer/src/generated/source_io.dart'; | 10 import 'package:analyzer/src/generated/source_io.dart'; |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 | 126 |
| 127 static void errorToJson_formattingApplied() { | 127 static void errorToJson_formattingApplied() { |
| 128 MockSource source = new MockSource(); | 128 MockSource source = new MockSource(); |
| 129 source.when(callsTo('get encoding')).alwaysReturn('foo.dart'); | 129 source.when(callsTo('get encoding')).alwaysReturn('foo.dart'); |
| 130 CompileTimeErrorCode errorCode = CompileTimeErrorCode.AMBIGUOUS_EXPORT; | 130 CompileTimeErrorCode errorCode = CompileTimeErrorCode.AMBIGUOUS_EXPORT; |
| 131 AnalysisError analysisError = | 131 AnalysisError analysisError = |
| 132 new AnalysisError.con1(source, errorCode, ['foo', 'bar', 'baz']); | 132 new AnalysisError.con1(source, errorCode, ['foo', 'bar', 'baz']); |
| 133 Map<String, Object> json = AnalysisServer.errorToJson(analysisError); | 133 Map<String, Object> json = AnalysisServer.errorToJson(analysisError); |
| 134 | 134 |
| 135 expect(json['message'], | 135 expect(json['message'], |
| 136 equals("The element 'foo' is defined in the libraries 'bar' and 'baz'"))
; | 136 equals("The name 'foo' is defined in the libraries 'bar' and 'baz'")); |
| 137 } | 137 } |
| 138 | 138 |
| 139 static void errorToJson_noCorrection() { | 139 static void errorToJson_noCorrection() { |
| 140 MockSource source = new MockSource(); | 140 MockSource source = new MockSource(); |
| 141 source.when(callsTo('get encoding')).alwaysReturn('foo.dart'); | 141 source.when(callsTo('get encoding')).alwaysReturn('foo.dart'); |
| 142 CompileTimeErrorCode errorCode = | 142 CompileTimeErrorCode errorCode = |
| 143 CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER; | 143 CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER; |
| 144 AnalysisError analysisError = | 144 AnalysisError analysisError = |
| 145 new AnalysisError.con2(source, 10, 5, errorCode, ['Foo']); | 145 new AnalysisError.con2(source, 10, 5, errorCode, ['Foo']); |
| 146 Map<String, Object> json = AnalysisServer.errorToJson(analysisError); | 146 Map<String, Object> json = AnalysisServer.errorToJson(analysisError); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 @override | 206 @override |
| 207 Response handleRequest(Request request) { | 207 Response handleRequest(Request request) { |
| 208 if (request.method == 'echo') { | 208 if (request.method == 'echo') { |
| 209 var response = new Response(request.id); | 209 var response = new Response(request.id); |
| 210 response.setResult('echo', true); | 210 response.setResult('echo', true); |
| 211 return response; | 211 return response; |
| 212 } | 212 } |
| 213 return null; | 213 return null; |
| 214 } | 214 } |
| 215 } | 215 } |
| OLD | NEW |