Add delay between writing file and modifying it (#6968)

* Add delay between writing file and modifying it

* Add type argument
This commit is contained in:
Luke Church
2016-11-21 20:17:41 -08:00
committed by GitHub
parent 516ac574c0
commit a0c567f751

View File

@@ -3,6 +3,7 @@
// found in the LICENSE file.
import 'dart:io';
import 'dart:async';
import 'package:flutter_tools/src/asset.dart';
import 'package:flutter_tools/src/build_info.dart';
@@ -39,18 +40,21 @@ void main() {
await devFS.update();
expect(devFSOperations.contains('writeFile test bar/foo.txt'), isTrue);
});
testUsingContext('modify existing file on local file system', () async {
File file = new File(path.join(basePath, filePath));
file.writeAsBytesSync(<int>[1, 2, 3, 4, 5, 6]);
await devFS.update();
expect(devFSOperations.contains('writeFile test bar/foo.txt'), isTrue);
});
testUsingContext('add new file to local file system', () async {
File file = new File(path.join(basePath, filePath2));
await file.parent.create(recursive: true);
file.writeAsBytesSync(<int>[1, 2, 3, 4, 5, 6, 7]);
await devFS.update();
expect(devFSOperations.contains('writeFile test foo/bar.txt'), isTrue);
// Need to delay between when we first write to a file and when
// we modify it.
await new Future<Null>.delayed(new Duration(seconds: 1));
});
testUsingContext('modify existing file on local file system', () async {
File file = new File(path.join(basePath, filePath));
await file.writeAsBytes(<int>[1, 2, 3, 4, 5, 6]);
await devFS.update();
expect(devFSOperations.contains('writeFile test bar/foo.txt'), isTrue);
});
testUsingContext('delete a file from the local file system', () async {
File file = new File(path.join(basePath, filePath));