Ian Hickson | ad1eaff | 2018-08-20 12:51:07 -0700 | [diff] [blame] | 1 | // Copyright 2018 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
Ian Hickson | ad1eaff | 2018-08-20 12:51:07 -0700 | [diff] [blame] | 5 | import 'dart:io'; |
| 6 | |
| 7 | import 'common.dart'; |
| 8 | |
| 9 | void main() { |
Greg Spencer | 202b045 | 2018-11-05 07:31:35 -0800 | [diff] [blame] | 10 | test('analyze-sample-code', () { |
| 11 | final ProcessResult process = Process.runSync( |
Ian Hickson | ad1eaff | 2018-08-20 12:51:07 -0700 | [diff] [blame] | 12 | '../../bin/cache/dart-sdk/bin/dart', |
| 13 | <String>['analyze-sample-code.dart', 'test/analyze-sample-code-test-input'], |
| 14 | ); |
Greg Spencer | 202b045 | 2018-11-05 07:31:35 -0800 | [diff] [blame] | 15 | final List<String> stdoutLines = process.stdout.toString().split('\n'); |
| 16 | final List<String> stderrLines = process.stderr.toString().split('\n') |
| 17 | ..removeWhere((String line) => line.startsWith('Analyzer output:')); |
| 18 | expect(process.exitCode, isNot(equals(0))); |
| 19 | expect(stderrLines, <String>[ |
LongCatIsLooong | 712195b | 2019-04-01 17:27:29 -0700 | [diff] [blame] | 20 | 'known_broken_documentation.dart:30:9: new Opacity(', |
Greg Spencer | 202b045 | 2018-11-05 07:31:35 -0800 | [diff] [blame] | 21 | '>>> Unnecessary new keyword (unnecessary_new)', |
LongCatIsLooong | 712195b | 2019-04-01 17:27:29 -0700 | [diff] [blame] | 22 | 'known_broken_documentation.dart:42:9: new Opacity(', |
Greg Spencer | 202b045 | 2018-11-05 07:31:35 -0800 | [diff] [blame] | 23 | '>>> Unnecessary new keyword (unnecessary_new)', |
| 24 | '', |
| 25 | 'Found 1 sample code errors.', |
| 26 | '', |
Ian Hickson | ad1eaff | 2018-08-20 12:51:07 -0700 | [diff] [blame] | 27 | ]); |
LongCatIsLooong | 712195b | 2019-04-01 17:27:29 -0700 | [diff] [blame] | 28 | expect(stdoutLines, <String>['Found 7 sample code sections.', 'Starting analysis of samples.', '']); |
Greg Spencer | 202b045 | 2018-11-05 07:31:35 -0800 | [diff] [blame] | 29 | }, skip: Platform.isWindows); |
Ian Hickson | ad1eaff | 2018-08-20 12:51:07 -0700 | [diff] [blame] | 30 | } |