mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00

This fixes the sample code analysis to treat dartpad snippets in the same way as snippet snippets, which it wasn't until now (the snippet generator was treating them as "samples"), and some errors crept in. This PR also fixes those errors. Also, added a --verbose option to the sample analyzer.
36 lines
1.2 KiB
Dart
36 lines
1.2 KiB
Dart
// 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() {
|
|
test('analyze-sample-code', () {
|
|
final ProcessResult process = Process.runSync(
|
|
'../../bin/cache/dart-sdk/bin/dart',
|
|
<String>['analyze-sample-code.dart', 'test/analyze-sample-code-test-input'],
|
|
);
|
|
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>[
|
|
'known_broken_documentation.dart:30:9: new Opacity(',
|
|
'>>> Unnecessary new keyword (unnecessary_new)',
|
|
'known_broken_documentation.dart:62:9: new Opacity(',
|
|
'>>> Unnecessary new keyword (unnecessary_new)',
|
|
'',
|
|
'Found 1 sample code errors.',
|
|
'',
|
|
]);
|
|
expect(stdoutLines, <String>[
|
|
'Found 7 sample code sections.',
|
|
'Generating snippet for known_broken_documentation.dart:38',
|
|
'Starting analysis of samples.',
|
|
'',
|
|
]);
|
|
}, skip: Platform.isWindows);
|
|
}
|