analyze-sample-code_test.dart 1.18 KB
Newer Older
1
// Copyright 2014 The Flutter Authors. All rights reserved.
2 3 4 5 6 7 8 9
// 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() {
10 11
  test('analyze-sample-code', () {
    final ProcessResult process = Process.runSync(
12 13 14
      '../../bin/cache/dart-sdk/bin/dart',
      <String>['analyze-sample-code.dart', 'test/analyze-sample-code-test-input'],
    );
15 16 17 18 19
    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>[
20
      'known_broken_documentation.dart:30:9: new Opacity(',
21
      '>>> Unnecessary new keyword (unnecessary_new)',
22
      'known_broken_documentation.dart:62:9: new Opacity(',
23 24 25 26
      '>>> Unnecessary new keyword (unnecessary_new)',
      '',
      'Found 1 sample code errors.',
      '',
27
    ]);
28 29
    expect(stdoutLines, <String>[
      'Found 7 sample code sections.',
30
       'Starting analysis of code samples.',
31 32
      '',
    ]);
33
  }, skip: Platform.isWindows);
34
}