| 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/error.dart'; | 10 import 'package:analyzer/src/generated/error.dart'; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 | 82 |
| 83 test('errorToJson_formattingApplied', () { | 83 test('errorToJson_formattingApplied', () { |
| 84 MockSource source = new MockSource(); | 84 MockSource source = new MockSource(); |
| 85 source.when(callsTo('get encoding')).alwaysReturn('foo.dart'); | 85 source.when(callsTo('get encoding')).alwaysReturn('foo.dart'); |
| 86 CompileTimeErrorCode errorCode = CompileTimeErrorCode.AMBIGUOUS_EXPORT; | 86 CompileTimeErrorCode errorCode = CompileTimeErrorCode.AMBIGUOUS_EXPORT; |
| 87 AnalysisError analysisError = | 87 AnalysisError analysisError = |
| 88 new AnalysisError.con1(source, errorCode, ['foo', 'bar', 'baz']); | 88 new AnalysisError.con1(source, errorCode, ['foo', 'bar', 'baz']); |
| 89 Map<String, Object> json = AnalysisServer.errorToJson(analysisError); | 89 Map<String, Object> json = AnalysisServer.errorToJson(analysisError); |
| 90 | 90 |
| 91 expect(json['message'], | 91 expect(json['message'], |
| 92 equals("The element 'foo' is defined in the libraries 'bar' and 'baz'"
)); | 92 equals("The name 'foo' is defined in the libraries 'bar' and 'baz'")); |
| 93 }); | 93 }); |
| 94 | 94 |
| 95 test('errorToJson_noCorrection', () { | 95 test('errorToJson_noCorrection', () { |
| 96 MockSource source = new MockSource(); | 96 MockSource source = new MockSource(); |
| 97 source.when(callsTo('get fullName')).alwaysReturn('foo.dart'); | 97 source.when(callsTo('get fullName')).alwaysReturn('foo.dart'); |
| 98 CompileTimeErrorCode errorCode = | 98 CompileTimeErrorCode errorCode = |
| 99 CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER; | 99 CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER; |
| 100 AnalysisError analysisError = | 100 AnalysisError analysisError = |
| 101 new AnalysisError.con2(source, 10, 5, errorCode, ['Foo']); | 101 new AnalysisError.con2(source, 10, 5, errorCode, ['Foo']); |
| 102 Map<String, Object> json = AnalysisServer.errorToJson(analysisError); | 102 Map<String, Object> json = AnalysisServer.errorToJson(analysisError); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 @override | 164 @override |
| 165 Response handleRequest(Request request) { | 165 Response handleRequest(Request request) { |
| 166 if (request.method == 'echo') { | 166 if (request.method == 'echo') { |
| 167 var response = new Response(request.id); | 167 var response = new Response(request.id); |
| 168 response.setResult('echo', true); | 168 response.setResult('echo', true); |
| 169 return response; | 169 return response; |
| 170 } | 170 } |
| 171 return null; | 171 return null; |
| 172 } | 172 } |
| 173 } | 173 } |
| OLD | NEW |