blob: 8e0f347a15a0fcadde6860b1f7ced9cd7f0e55a4 [file] [log] [blame]
Ian Hicksonad1eaff2018-08-20 12:51:07 -07001// 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 Hicksonad1eaff2018-08-20 12:51:07 -07005import 'dart:io';
6
7import 'common.dart';
8
9void main() {
Greg Spencer202b0452018-11-05 07:31:35 -080010 test('analyze-sample-code', () {
11 final ProcessResult process = Process.runSync(
Ian Hicksonad1eaff2018-08-20 12:51:07 -070012 '../../bin/cache/dart-sdk/bin/dart',
13 <String>['analyze-sample-code.dart', 'test/analyze-sample-code-test-input'],
14 );
Greg Spencer202b0452018-11-05 07:31:35 -080015 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>[
LongCatIsLooong712195b2019-04-01 17:27:29 -070020 'known_broken_documentation.dart:30:9: new Opacity(',
Greg Spencer202b0452018-11-05 07:31:35 -080021 '>>> Unnecessary new keyword (unnecessary_new)',
LongCatIsLooong712195b2019-04-01 17:27:29 -070022 'known_broken_documentation.dart:42:9: new Opacity(',
Greg Spencer202b0452018-11-05 07:31:35 -080023 '>>> Unnecessary new keyword (unnecessary_new)',
24 '',
25 'Found 1 sample code errors.',
26 '',
Ian Hicksonad1eaff2018-08-20 12:51:07 -070027 ]);
LongCatIsLooong712195b2019-04-01 17:27:29 -070028 expect(stdoutLines, <String>['Found 7 sample code sections.', 'Starting analysis of samples.', '']);
Greg Spencer202b0452018-11-05 07:31:35 -080029 }, skip: Platform.isWindows);
Ian Hicksonad1eaff2018-08-20 12:51:07 -070030}