| 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.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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |