File tree Expand file tree Collapse file tree 5 files changed +27
-0
lines changed Expand file tree Collapse file tree 5 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,12 @@ import 'package:watcher/src/utils.dart';
1212import '../utils.dart' ;
1313
1414void fileTests () {
15+ for (var i = 0 ; i != runsPerTest; ++ i) {
16+ _fileTests ();
17+ }
18+ }
19+
20+ void _fileTests () {
1521 test ('does not notify for files that already exist when started' , () async {
1622 // Make some pre-existing files.
1723 writeFile ('a.txt' );
Original file line number Diff line number Diff line change @@ -9,6 +9,12 @@ import 'package:test/test.dart';
99import '../utils.dart' ;
1010
1111void linkTests ({required bool isNative}) {
12+ for (var i = 0 ; i != runsPerTest; ++ i) {
13+ _linkTests (isNative: isNative);
14+ }
15+ }
16+
17+ void _linkTests ({required bool isNative}) {
1218 test ('notifies when a link is added' , () async {
1319 createDir ('targets' );
1420 createDir ('links' );
Original file line number Diff line number Diff line change @@ -13,6 +13,12 @@ void fileTests({required bool isNative}) {
1313 writeFile ('file.txt' );
1414 });
1515
16+ for (var i = 0 ; i != runsPerTest; ++ i) {
17+ _fileTests (isNative: isNative);
18+ }
19+ }
20+
21+ void _fileTests ({required bool isNative}) {
1622 test ("doesn't notify if the file isn't modified" , () async {
1723 await startWatcher (path: 'file.txt' );
1824 await expectNoEvents ();
Original file line number Diff line number Diff line change @@ -12,6 +12,12 @@ void linkTests({required bool isNative}) {
1212 writeLink (link: 'link.txt' , target: 'target.txt' );
1313 });
1414
15+ for (var i = 0 ; i != runsPerTest; ++ i) {
16+ _linkTests (isNative: isNative);
17+ }
18+ }
19+
20+ void _linkTests ({required bool isNative}) {
1521 test ("doesn't notify if nothing is modified" , () async {
1622 await startWatcher (path: 'link.txt' );
1723 await expectNoEvents ();
Original file line number Diff line number Diff line change @@ -12,6 +12,9 @@ import 'package:test_descriptor/test_descriptor.dart' as d;
1212import 'package:watcher/src/stat.dart' ;
1313import 'package:watcher/watcher.dart' ;
1414
15+ /// Edit this to run fast-running tests many times.
16+ int runsPerTest = 100 ;
17+
1518typedef WatcherFactory = Watcher Function (String directory);
1619
1720/// Sets the function used to create the watcher.
You can’t perform that action at this time.
0 commit comments