Skip to content

Commit

Permalink
Add delay between writing file and modifying it (flutter#6968)
Browse files Browse the repository at this point in the history
* Add delay between writing file and modifying it

* Add type argument
  • Loading branch information
lukechurch authored Nov 22, 2016
1 parent 516ac57 commit a0c567f
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions packages/flutter_tools/test/devfs_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit a0c567f

Please sign in to comment.