| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 analyzer_cli.test.formatter; | 5 library analyzer_cli.test.formatter; |
| 6 | 6 |
| 7 import 'package:analyzer/analyzer.dart'; | 7 import 'package:analyzer/analyzer.dart'; |
| 8 import 'package:analyzer/src/generated/engine.dart'; | 8 import 'package:analyzer/src/generated/engine.dart'; |
| 9 import 'package:analyzer_cli/src/ansi.dart' as ansi; | 9 import 'package:analyzer_cli/src/ansi.dart' as ansi; |
| 10 import 'package:analyzer_cli/src/error_formatter.dart'; | 10 import 'package:analyzer_cli/src/error_formatter.dart'; |
| 11 import 'package:test/test.dart' hide ErrorFormatter; | 11 import 'package:test/test.dart' hide ErrorFormatter; |
| 12 import 'package:typed_mock/typed_mock.dart'; | 12 import 'package:mockito/mockito.dart'; |
| 13 | 13 |
| 14 import 'mocks.dart'; | 14 import 'mocks.dart'; |
| 15 | 15 |
| 16 main() { | 16 main() { |
| 17 group('reporter', () { | 17 group('reporter', () { |
| 18 StringBuffer out; | 18 StringBuffer out; |
| 19 AnalysisStats stats; | 19 AnalysisStats stats; |
| 20 MockCommandLineOptions options; | 20 MockCommandLineOptions options; |
| 21 ErrorFormatter reporter; | 21 ErrorFormatter reporter; |
| 22 | 22 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 } | 73 } |
| 74 | 74 |
| 75 MockAnalysisErrorInfo mockError(ErrorType type, ErrorSeverity severity) { | 75 MockAnalysisErrorInfo mockError(ErrorType type, ErrorSeverity severity) { |
| 76 // ErrorInfo | 76 // ErrorInfo |
| 77 var info = new MockAnalysisErrorInfo(); | 77 var info = new MockAnalysisErrorInfo(); |
| 78 var error = new MockAnalysisError(); | 78 var error = new MockAnalysisError(); |
| 79 var lineInfo = new MockLineInfo(); | 79 var lineInfo = new MockLineInfo(); |
| 80 var location = new MockLineInfo_Location(); | 80 var location = new MockLineInfo_Location(); |
| 81 when(location.columnNumber).thenReturn(3); | 81 when(location.columnNumber).thenReturn(3); |
| 82 when(location.lineNumber).thenReturn(3); | 82 when(location.lineNumber).thenReturn(3); |
| 83 when(lineInfo.getLocation(anyObject)).thenReturn(location); | 83 when(lineInfo.getLocation(any)).thenReturn(location); |
| 84 when(info.lineInfo).thenReturn(lineInfo); | 84 when(info.lineInfo).thenReturn(lineInfo); |
| 85 | 85 |
| 86 // Details | 86 // Details |
| 87 var code = new MockErrorCode(); | 87 var code = new MockErrorCode(); |
| 88 when(code.type).thenReturn(type); | 88 when(code.type).thenReturn(type); |
| 89 when(code.errorSeverity).thenReturn(severity); | 89 when(code.errorSeverity).thenReturn(severity); |
| 90 when(code.name).thenReturn('mock_code'); | 90 when(code.name).thenReturn('mock_code'); |
| 91 when(error.errorCode).thenReturn(code); | 91 when(error.errorCode).thenReturn(code); |
| 92 when(error.message).thenReturn('MSG'); | 92 when(error.message).thenReturn('MSG'); |
| 93 when(error.offset).thenReturn(20); | 93 when(error.offset).thenReturn(20); |
| 94 var source = new MockSource(); | 94 var source = new MockSource(); |
| 95 when(source.fullName).thenReturn('/foo/bar/baz.dart'); | 95 when(source.fullName).thenReturn('/foo/bar/baz.dart'); |
| 96 when(error.source).thenReturn(source); | 96 when(error.source).thenReturn(source); |
| 97 when(info.errors).thenReturn([error]); | 97 when(info.errors).thenReturn([error]); |
| 98 | 98 |
| 99 return info; | 99 return info; |
| 100 } | 100 } |
| OLD | NEW |