2018-08-20 19:51:07 +00:00
|
|
|
// Copyright 2018 The Chromium Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
import 'dart:io';
|
|
|
|
|
|
|
|
import 'common.dart';
|
|
|
|
|
|
|
|
void main() {
|
2018-11-05 15:31:35 +00:00
|
|
|
test('analyze-sample-code', () {
|
|
|
|
final ProcessResult process = Process.runSync(
|
2018-08-20 19:51:07 +00:00
|
|
|
'../../bin/cache/dart-sdk/bin/dart',
|
|
|
|
<String>['analyze-sample-code.dart', 'test/analyze-sample-code-test-input'],
|
|
|
|
);
|
2018-11-05 15:31:35 +00:00
|
|
|
final List<String> stdoutLines = process.stdout.toString().split('\n');
|
|
|
|
final List<String> stderrLines = process.stderr.toString().split('\n')
|
|
|
|
..removeWhere((String line) => line.startsWith('Analyzer output:'));
|
|
|
|
expect(process.exitCode, isNot(equals(0)));
|
|
|
|
expect(stderrLines, <String>[
|
2019-04-02 00:27:29 +00:00
|
|
|
'known_broken_documentation.dart:30:9: new Opacity(',
|
2018-11-05 15:31:35 +00:00
|
|
|
'>>> Unnecessary new keyword (unnecessary_new)',
|
2019-04-02 00:27:29 +00:00
|
|
|
'known_broken_documentation.dart:42:9: new Opacity(',
|
2018-11-05 15:31:35 +00:00
|
|
|
'>>> Unnecessary new keyword (unnecessary_new)',
|
|
|
|
'',
|
|
|
|
'Found 1 sample code errors.',
|
|
|
|
'',
|
2018-08-20 19:51:07 +00:00
|
|
|
]);
|
2019-04-02 00:27:29 +00:00
|
|
|
expect(stdoutLines, <String>['Found 7 sample code sections.', 'Starting analysis of samples.', '']);
|
2018-11-05 15:31:35 +00:00
|
|
|
}, skip: Platform.isWindows);
|
2018-08-20 19:51:07 +00:00
|
|
|
}
|