blob: a635d7a0a6b66bb9bb4a9c4df352fb47bf28250f [file] [log] [blame]
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
/// @assertion Future<bool> exists()
/// Checks whether the file system entity with this path exists. Returns a
/// Future<bool> that completes with the result.
///
/// Since FileSystemEntity is abstract, every FileSystemEntity object is actually
/// an instance of one of the subclasses File, Directory, and Link. Calling
/// exists on an instance of one of these subclasses checks whether the object
/// exists in the file system object exists and is of the correct type (file,
/// directory, or link). To check whether a path points to an object on the file
/// system, regardless of the object's type, use the type static method.
/// @description Checks that this method checks whether the file system entity
/// with this path exists and has correct type. Test Link
/// @author sgrekhov@unipro.ru
/// @issue 30873
import "dart:io";
import "../../../Utils/expect.dart";
import "../file_utils.dart";
main() async {
await inSandbox(_main);
}
void _main(Directory sandbox) async {
Link link = getTempLinkSync(parent: sandbox);
Directory dir = new Directory(link.path);
asyncStart();
await dir.exists().then((result) {
Expect.isFalse(result);
asyncEnd();
});
}