forked from flutter/flutter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommon.dart
More file actions
36 lines (30 loc) · 1.32 KB
/
common.dart
File metadata and controls
36 lines (30 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright 2016 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 'package:args/command_runner.dart';
import 'package:test/test.dart';
import 'package:flutter_tools/src/base/common.dart';
import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/runner/flutter_command.dart';
import 'package:flutter_tools/src/runner/flutter_command_runner.dart';
CommandRunner<Null> createTestCommandRunner([FlutterCommand command]) {
FlutterCommandRunner runner = new FlutterCommandRunner();
if (command != null)
runner.addCommand(command);
return runner;
}
/// Updates [path] to have a modification time [seconds] from now.
void updateFileModificationTime(String path,
DateTime baseTime,
int seconds) {
DateTime modificationTime = baseTime.add(new Duration(seconds: seconds));
fs.file(path).setLastModifiedSync(modificationTime);
}
/// Matcher for functions that throw ToolExit.
Matcher throwsToolExit([int exitCode]) {
return exitCode == null
? throwsA(isToolExit)
: throwsA(allOf(isToolExit, (ToolExit e) => e.exitCode == exitCode));
}
/// Matcher for [ToolExit]s.
const Matcher isToolExit = const isInstanceOf<ToolExit>();