| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 SEVERITY: 'ERROR', | 65 SEVERITY: 'ERROR', |
| 66 TYPE: 'COMPILE_TIME_ERROR', | 66 TYPE: 'COMPILE_TIME_ERROR', |
| 67 LOCATION: { | 67 LOCATION: { |
| 68 FILE: 'foo.dart', | 68 FILE: 'foo.dart', |
| 69 OFFSET: 10, | 69 OFFSET: 10, |
| 70 LENGTH: 20, | 70 LENGTH: 20, |
| 71 START_LINE: 3, | 71 START_LINE: 3, |
| 72 START_COLUMN: 2 | 72 START_COLUMN: 2 |
| 73 }, | 73 }, |
| 74 MESSAGE: 'my message', | 74 MESSAGE: 'my message', |
| 75 CORRECTION: 'my correction' | 75 CORRECTION: 'my correction', |
| 76 HAS_FIX : false |
| 76 }); | 77 }); |
| 77 } | 78 } |
| 78 | 79 |
| 79 void test_fromEngine_noCorrection() { | 80 void test_fromEngine_noCorrection() { |
| 80 when(engineError.correction).thenReturn(null); | 81 when(engineError.correction).thenReturn(null); |
| 81 AnalysisError error = newAnalysisError_fromEngine(lineInfo, engineError); | 82 AnalysisError error = newAnalysisError_fromEngine(lineInfo, engineError); |
| 82 expect(error.toJson(), { | 83 expect(error.toJson(), { |
| 83 SEVERITY: 'ERROR', | 84 SEVERITY: 'ERROR', |
| 84 TYPE: 'COMPILE_TIME_ERROR', | 85 TYPE: 'COMPILE_TIME_ERROR', |
| 85 LOCATION: { | 86 LOCATION: { |
| 86 FILE: 'foo.dart', | 87 FILE: 'foo.dart', |
| 87 OFFSET: 10, | 88 OFFSET: 10, |
| 88 LENGTH: 20, | 89 LENGTH: 20, |
| 89 START_LINE: 3, | 90 START_LINE: 3, |
| 90 START_COLUMN: 2 | 91 START_COLUMN: 2 |
| 91 }, | 92 }, |
| 92 MESSAGE: 'my message' | 93 MESSAGE: 'my message', |
| 94 HAS_FIX : false |
| 93 }); | 95 }); |
| 94 } | 96 } |
| 95 | 97 |
| 96 void test_fromEngine_noLineInfo() { | 98 void test_fromEngine_noLineInfo() { |
| 97 when(engineError.correction).thenReturn(null); | 99 when(engineError.correction).thenReturn(null); |
| 98 AnalysisError error = newAnalysisError_fromEngine(null, engineError); | 100 AnalysisError error = newAnalysisError_fromEngine(null, engineError); |
| 99 expect(error.toJson(), { | 101 expect(error.toJson(), { |
| 100 SEVERITY: 'ERROR', | 102 SEVERITY: 'ERROR', |
| 101 TYPE: 'COMPILE_TIME_ERROR', | 103 TYPE: 'COMPILE_TIME_ERROR', |
| 102 LOCATION: { | 104 LOCATION: { |
| 103 FILE: 'foo.dart', | 105 FILE: 'foo.dart', |
| 104 OFFSET: 10, | 106 OFFSET: 10, |
| 105 LENGTH: 20, | 107 LENGTH: 20, |
| 106 START_LINE: -1, | 108 START_LINE: -1, |
| 107 START_COLUMN: -1 | 109 START_COLUMN: -1 |
| 108 }, | 110 }, |
| 109 MESSAGE: 'my message' | 111 MESSAGE: 'my message', |
| 112 HAS_FIX : false |
| 110 }); | 113 }); |
| 111 } | 114 } |
| 112 } | 115 } |
| 113 | 116 |
| 114 @reflectiveTest | 117 @reflectiveTest |
| 115 class ElementKindTest { | 118 class ElementKindTest { |
| 116 void test_fromEngine() { | 119 void test_fromEngine() { |
| 117 expect( | 120 expect( |
| 118 newElementKind_fromEngine(engine.ElementKind.CLASS), ElementKind.CLASS); | 121 newElementKind_fromEngine(engine.ElementKind.CLASS), ElementKind.CLASS); |
| 119 expect(newElementKind_fromEngine(engine.ElementKind.COMPILATION_UNIT), | 122 expect(newElementKind_fromEngine(engine.ElementKind.COMPILATION_UNIT), |
| (...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 ApiEnum apiValue = convert(engineValue); | 647 ApiEnum apiValue = convert(engineValue); |
| 645 expect(apiValue, equals(expectedResult)); | 648 expect(apiValue, equals(expectedResult)); |
| 646 } | 649 } |
| 647 } else { | 650 } else { |
| 648 ApiEnum apiValue = convert(engineValue); | 651 ApiEnum apiValue = convert(engineValue); |
| 649 expect(apiValue.name, equals(enumName)); | 652 expect(apiValue.name, equals(enumName)); |
| 650 } | 653 } |
| 651 }); | 654 }); |
| 652 } | 655 } |
| 653 } | 656 } |
| OLD | NEW |