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

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

Issue 1774913006: Add error codes to server protocol (#25958). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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
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.element; 5 library test.computer.element;
6 6
7 import 'dart:mirrors'; 7 import 'dart:mirrors';
8 8
9 import 'package:analysis_server/src/constants.dart'; 9 import 'package:analysis_server/src/constants.dart';
10 import 'package:analysis_server/src/protocol_server.dart'; 10 import 'package:analysis_server/src/protocol_server.dart';
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 TYPE: 'COMPILE_TIME_ERROR', 62 TYPE: 'COMPILE_TIME_ERROR',
63 LOCATION: { 63 LOCATION: {
64 FILE: 'foo.dart', 64 FILE: 'foo.dart',
65 OFFSET: 10, 65 OFFSET: 10,
66 LENGTH: 20, 66 LENGTH: 20,
67 START_LINE: 3, 67 START_LINE: 3,
68 START_COLUMN: 2 68 START_COLUMN: 2
69 }, 69 },
70 MESSAGE: 'my message', 70 MESSAGE: 'my message',
71 CORRECTION: 'my correction', 71 CORRECTION: 'my correction',
72 CODE: 'ambiguous_export',
72 HAS_FIX: false 73 HAS_FIX: false
73 }); 74 });
74 } 75 }
75 76
76 void test_fromEngine_noCorrection() { 77 void test_fromEngine_noCorrection() {
77 when(engineError.correction).thenReturn(null); 78 when(engineError.correction).thenReturn(null);
78 AnalysisError error = newAnalysisError_fromEngine(lineInfo, engineError); 79 AnalysisError error = newAnalysisError_fromEngine(lineInfo, engineError);
79 expect(error.toJson(), { 80 expect(error.toJson(), {
80 SEVERITY: 'ERROR', 81 SEVERITY: 'ERROR',
81 TYPE: 'COMPILE_TIME_ERROR', 82 TYPE: 'COMPILE_TIME_ERROR',
82 LOCATION: { 83 LOCATION: {
83 FILE: 'foo.dart', 84 FILE: 'foo.dart',
84 OFFSET: 10, 85 OFFSET: 10,
85 LENGTH: 20, 86 LENGTH: 20,
86 START_LINE: 3, 87 START_LINE: 3,
87 START_COLUMN: 2 88 START_COLUMN: 2
88 }, 89 },
89 MESSAGE: 'my message', 90 MESSAGE: 'my message',
91 CODE: 'ambiguous_export',
90 HAS_FIX: false 92 HAS_FIX: false
91 }); 93 });
92 } 94 }
93 95
94 void test_fromEngine_noLineInfo() { 96 void test_fromEngine_noLineInfo() {
95 when(engineError.correction).thenReturn(null); 97 when(engineError.correction).thenReturn(null);
96 AnalysisError error = newAnalysisError_fromEngine(null, engineError); 98 AnalysisError error = newAnalysisError_fromEngine(null, engineError);
97 expect(error.toJson(), { 99 expect(error.toJson(), {
98 SEVERITY: 'ERROR', 100 SEVERITY: 'ERROR',
99 TYPE: 'COMPILE_TIME_ERROR', 101 TYPE: 'COMPILE_TIME_ERROR',
100 LOCATION: { 102 LOCATION: {
101 FILE: 'foo.dart', 103 FILE: 'foo.dart',
102 OFFSET: 10, 104 OFFSET: 10,
103 LENGTH: 20, 105 LENGTH: 20,
104 START_LINE: -1, 106 START_LINE: -1,
105 START_COLUMN: -1 107 START_COLUMN: -1
106 }, 108 },
107 MESSAGE: 'my message', 109 MESSAGE: 'my message',
110 CODE: 'ambiguous_export',
108 HAS_FIX: false 111 HAS_FIX: false
109 }); 112 });
110 } 113 }
111 } 114 }
112 115
113 @reflectiveTest 116 @reflectiveTest
114 class EnumTest { 117 class EnumTest {
115 void test_AnalysisErrorSeverity() { 118 void test_AnalysisErrorSeverity() {
116 new EnumTester<engine.ErrorSeverity, AnalysisErrorSeverity>().run( 119 new EnumTester<engine.ErrorSeverity, AnalysisErrorSeverity>().run(
117 (engine.ErrorSeverity engineErrorSeverity) => 120 (engine.ErrorSeverity engineErrorSeverity) =>
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 ApiEnum apiValue = convert(engineValue); 185 ApiEnum apiValue = convert(engineValue);
183 expect(apiValue, equals(expectedResult)); 186 expect(apiValue, equals(expectedResult));
184 } 187 }
185 } else { 188 } else {
186 ApiEnum apiValue = convert(engineValue); 189 ApiEnum apiValue = convert(engineValue);
187 expect(apiValue.name, equals(enumName)); 190 expect(apiValue.name, equals(enumName));
188 } 191 }
189 }); 192 });
190 } 193 }
191 } 194 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698