bug_report_test.dart 905 Bytes
Newer Older
1 2 3 4
// Copyright 2017 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.

5
import 'package:file_testing/file_testing.dart';
6 7
import 'package:mockito/mockito.dart';

8 9 10 11 12
import 'package:flutter_tools/executable.dart' as tools;
import 'package:flutter_tools/src/cache.dart';
import 'package:flutter_tools/src/base/io.dart';
import 'package:flutter_tools/src/base/os.dart';

13
import 'src/common.dart';
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
import 'src/context.dart';

void main() {
  Cache.disableLocking();

  int exitCode;
  setExitFunctionForTests((int code) {
    exitCode = code;
  });

  group('--bug-report', () {
    testUsingContext('generates valid zip file', () async {
      await tools.main(<String>['devices', '--bug-report']);
      expect(exitCode, 0);
      verify(os.zip(any, argThat(hasPath(matches(r'bugreport_01\.zip')))));
    });
  });
}