logs_test.dart 922 Bytes
Newer Older
Ian Hickson's avatar
Ian Hickson committed
1
// Copyright 2014 The Flutter Authors. All rights reserved.
2 3 4
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

5 6
// @dart = 2.8

7
import 'package:flutter_tools/src/base/common.dart';
8
import 'package:flutter_tools/src/cache.dart';
9
import 'package:flutter_tools/src/commands/logs.dart';
10

11
import '../../src/context.dart';
12
import '../../src/test_flutter_command_runner.dart';
13

14
void main() {
15
  group('logs', () {
16 17 18 19 20 21 22 23
    setUp(() {
      Cache.disableLocking();
    });

    tearDown(() {
      Cache.enableLocking();
    });

24
    testUsingContext('fail with a bad device id', () async {
25
      final LogsCommand command = LogsCommand();
26 27 28 29
      await expectLater(
        () => createTestCommandRunner(command).run(<String>['-d', 'abc123', 'logs']),
        throwsA(isA<ToolExit>().having((ToolExit error) => error.exitCode, 'exitCode', anyOf(isNull, 1))),
      );
30 31 32
    });
  });
}