| 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.operation.analysis; | 5 library test.operation.analysis; |
| 6 | 6 |
| 7 import 'package:analysis_server/src/constants.dart'; | 7 import 'package:analysis_server/src/constants.dart'; |
| 8 import 'package:analysis_server/src/operation/operation_analysis.dart'; | 8 import 'package:analysis_server/src/operation/operation_analysis.dart'; |
| 9 import 'package:analysis_testing/mocks.dart'; | 9 import 'package:analysis_testing/mocks.dart'; |
| 10 import 'package:analysis_testing/reflective_tests.dart'; | 10 import 'package:analysis_testing/reflective_tests.dart'; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 } | 49 } |
| 50 | 50 |
| 51 void tearDown() { | 51 void tearDown() { |
| 52 source = null; | 52 source = null; |
| 53 analysisError = null; | 53 analysisError = null; |
| 54 } | 54 } |
| 55 | 55 |
| 56 void test_noCorrection() { | 56 void test_noCorrection() { |
| 57 Map<String, Object> json = errorToJson(lineInfo, analysisError); | 57 Map<String, Object> json = errorToJson(lineInfo, analysisError); |
| 58 expect(json, { | 58 expect(json, { |
| 59 ERROR_CODE: 'CompileTimeErrorCode.AMBIGUOUS_EXPORT', | |
| 60 SEVERITY: 'ERROR', | 59 SEVERITY: 'ERROR', |
| 61 TYPE: 'COMPILE_TIME_ERROR', | 60 TYPE: 'COMPILE_TIME_ERROR', |
| 62 LOCATION: { | 61 LOCATION: { |
| 63 FILE: 'foo.dart', | 62 FILE: 'foo.dart', |
| 64 OFFSET: 10, | 63 OFFSET: 10, |
| 65 LENGTH: 20, | 64 LENGTH: 20, |
| 66 START_LINE: 3, | 65 START_LINE: 3, |
| 67 START_COLUMN: 2 | 66 START_COLUMN: 2 |
| 68 }, | 67 }, |
| 69 MESSAGE: 'my message' | 68 MESSAGE: 'my message' |
| 70 }); | 69 }); |
| 71 } | 70 } |
| 72 | 71 |
| 73 void test_noLineInfo() { | 72 void test_noLineInfo() { |
| 74 Map<String, Object> json = errorToJson(null, analysisError); | 73 Map<String, Object> json = errorToJson(null, analysisError); |
| 75 expect(json, { | 74 expect(json, { |
| 76 ERROR_CODE: 'CompileTimeErrorCode.AMBIGUOUS_EXPORT', | |
| 77 SEVERITY: 'ERROR', | 75 SEVERITY: 'ERROR', |
| 78 TYPE: 'COMPILE_TIME_ERROR', | 76 TYPE: 'COMPILE_TIME_ERROR', |
| 79 LOCATION: { | 77 LOCATION: { |
| 80 FILE: 'foo.dart', | 78 FILE: 'foo.dart', |
| 81 OFFSET: 10, | 79 OFFSET: 10, |
| 82 LENGTH: 20 | 80 LENGTH: 20 |
| 83 }, | 81 }, |
| 84 MESSAGE: 'my message' | 82 MESSAGE: 'my message' |
| 85 }); | 83 }); |
| 86 } | 84 } |
| 87 | 85 |
| 88 void test_withCorrection() { | 86 void test_withCorrection() { |
| 89 when(analysisError.correction).thenReturn('my correction'); | 87 when(analysisError.correction).thenReturn('my correction'); |
| 90 Map<String, Object> json = errorToJson(lineInfo, analysisError); | 88 Map<String, Object> json = errorToJson(lineInfo, analysisError); |
| 91 expect(json, { | 89 expect(json, { |
| 92 ERROR_CODE: 'CompileTimeErrorCode.AMBIGUOUS_EXPORT', | |
| 93 SEVERITY: 'ERROR', | 90 SEVERITY: 'ERROR', |
| 94 TYPE: 'COMPILE_TIME_ERROR', | 91 TYPE: 'COMPILE_TIME_ERROR', |
| 95 LOCATION: { | 92 LOCATION: { |
| 96 FILE: 'foo.dart', | 93 FILE: 'foo.dart', |
| 97 OFFSET: 10, | 94 OFFSET: 10, |
| 98 LENGTH: 20, | 95 LENGTH: 20, |
| 99 START_LINE: 3, | 96 START_LINE: 3, |
| 100 START_COLUMN: 2 | 97 START_COLUMN: 2 |
| 101 }, | 98 }, |
| 102 MESSAGE: 'my message', | 99 MESSAGE: 'my message', |
| 103 CORRECTION: 'my correction' | 100 CORRECTION: 'my correction' |
| 104 }); | 101 }); |
| 105 } | 102 } |
| 106 } | 103 } |
| OLD | NEW |