2018-08-15 03:33:58 +00:00
|
|
|
// Copyright 2018 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.
|
|
|
|
|
2018-08-17 20:17:23 +00:00
|
|
|
import 'dart:io';
|
|
|
|
|
2019-11-14 17:31:36 +00:00
|
|
|
import 'package:test_api/test_api.dart' hide TypeMatcher, isInstanceOf; // ignore: deprecated_member_use
|
|
|
|
import 'package:test_api/test_api.dart' as test_package show TypeMatcher; // ignore: deprecated_member_use
|
2018-08-15 03:33:58 +00:00
|
|
|
|
2019-11-14 17:31:36 +00:00
|
|
|
export 'package:test_api/test_api.dart' hide TypeMatcher, isInstanceOf; // ignore: deprecated_member_use
|
2018-08-15 03:33:58 +00:00
|
|
|
|
|
|
|
// Defines a 'package:test' shim.
|
2018-08-17 20:17:23 +00:00
|
|
|
// TODO(ianh): Clean this up once https://github.com/dart-lang/matcher/issues/98 is fixed
|
2018-08-15 03:33:58 +00:00
|
|
|
|
|
|
|
/// A matcher that compares the type of the actual value to the type argument T.
|
2018-09-18 03:54:03 +00:00
|
|
|
Matcher isInstanceOf<T>() => test_package.TypeMatcher<T>();
|
2018-08-17 20:17:23 +00:00
|
|
|
|
|
|
|
void tryToDelete(Directory directory) {
|
|
|
|
// This should not be necessary, but it turns out that
|
|
|
|
// on Windows it's common for deletions to fail due to
|
|
|
|
// bogus (we think) "access denied" errors.
|
|
|
|
try {
|
|
|
|
directory.deleteSync(recursive: true);
|
|
|
|
} on FileSystemException catch (error) {
|
|
|
|
print('Failed to delete ${directory.path}: $error');
|
|
|
|
}
|
2018-12-18 09:05:12 +00:00
|
|
|
}
|