• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2018 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5import 'dart:io';
6
7import 'package:test_api/test_api.dart' hide TypeMatcher, isInstanceOf;
8import 'package:test_api/test_api.dart' as test_package show TypeMatcher;
9
10export 'package:test_api/test_api.dart' hide TypeMatcher, isInstanceOf;
11
12// Defines a 'package:test' shim.
13// TODO(ianh): Clean this up once https://github.com/dart-lang/matcher/issues/98 is fixed
14
15/// A matcher that compares the type of the actual value to the type argument T.
16Matcher isInstanceOf<T>() => test_package.TypeMatcher<T>();
17
18void tryToDelete(Directory directory) {
19  // This should not be necessary, but it turns out that
20  // on Windows it's common for deletions to fail due to
21  // bogus (we think) "access denied" errors.
22  try {
23    directory.deleteSync(recursive: true);
24  } on FileSystemException catch (error) {
25    print('Failed to delete ${directory.path}: $error');
26  }
27}
28