| 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_cli/src/ansi.dart' as ansi; | 8 import 'package:analyzer_cli/src/ansi.dart' as ansi; |
| 9 import 'package:analyzer_cli/src/error_formatter.dart'; | 9 import 'package:analyzer_cli/src/error_formatter.dart'; |
| 10 import 'package:test/test.dart' hide ErrorFormatter; | 10 import 'package:test/test.dart' hide ErrorFormatter; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 out.clear(); | 26 out.clear(); |
| 27 ansi.runningTests = false; | 27 ansi.runningTests = false; |
| 28 }); | 28 }); |
| 29 | 29 |
| 30 // Options | 30 // Options |
| 31 var options = new MockCommandLineOptions(); | 31 var options = new MockCommandLineOptions(); |
| 32 when(options.enableTypeChecks).thenReturn(false); | 32 when(options.enableTypeChecks).thenReturn(false); |
| 33 when(options.hintsAreFatal).thenReturn(false); | 33 when(options.hintsAreFatal).thenReturn(false); |
| 34 when(options.machineFormat).thenReturn(false); | 34 when(options.machineFormat).thenReturn(false); |
| 35 when(options.verbose).thenReturn(false); | 35 when(options.verbose).thenReturn(false); |
| 36 when(options.color).thenReturn(false); |
| 36 | 37 |
| 37 var reporter = new ErrorFormatter(out, options, stats); | 38 var reporter = new ErrorFormatter(out, options, stats); |
| 38 | 39 |
| 39 test('error', () { | 40 test('error', () { |
| 40 var error = mockError(ErrorType.SYNTACTIC_ERROR, ErrorSeverity.ERROR); | 41 var error = mockError(ErrorType.SYNTACTIC_ERROR, ErrorSeverity.ERROR); |
| 41 reporter.formatErrors([error]); | 42 reporter.formatErrors([error]); |
| 42 | 43 |
| 43 expect(out.toString().trim(), | 44 expect(out.toString().trim(), |
| 44 'error • MSG at /foo/bar/baz.dart:3:3 • mock_code'); | 45 'error • MSG at /foo/bar/baz.dart:3:3 • mock_code'); |
| 45 }); | 46 }); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 when(code.name).thenReturn('mock_code'); | 83 when(code.name).thenReturn('mock_code'); |
| 83 when(error.errorCode).thenReturn(code); | 84 when(error.errorCode).thenReturn(code); |
| 84 when(error.message).thenReturn('MSG'); | 85 when(error.message).thenReturn('MSG'); |
| 85 var source = new MockSource(); | 86 var source = new MockSource(); |
| 86 when(source.fullName).thenReturn('/foo/bar/baz.dart'); | 87 when(source.fullName).thenReturn('/foo/bar/baz.dart'); |
| 87 when(error.source).thenReturn(source); | 88 when(error.source).thenReturn(source); |
| 88 when(info.errors).thenReturn([error]); | 89 when(info.errors).thenReturn([error]); |
| 89 | 90 |
| 90 return info; | 91 return info; |
| 91 } | 92 } |
| OLD | NEW |