Skip to content

Commit

Permalink
create full mini example
Browse files Browse the repository at this point in the history
  • Loading branch information
bartekpacia committed Sep 21, 2023
1 parent f238d82 commit 9f63eeb
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions packages/patrol/test/callbacks_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,28 @@ void main() {
print('setting up before $currentTest');
});

tearDown(() {
patrolTearDown(() {
print('tearing down after $currentTest');
});

test('testA', _body);
test('testB', _body);
test('testC', _body);
patrolTest('testA', _body);
patrolTest('testB', _body);
patrolTest('testC', _body);
});
}

void _body() => print(Invoker.current!.fullCurrentTestName());
Future<void> _body() async => print(Invoker.current!.fullCurrentTestName());

void patrolTest(String name, Future<void> Function() body) {
test(name, () async {
final currentTest = Invoker.current!.fullCurrentTestName();

if (currentTest == requestedTest) {
print('Requested test $currentTest, will execute it');
await body();
}
});
}

void patrolSetUp(dynamic Function() body) {
setUp(() {
Expand Down

0 comments on commit 9f63eeb

Please sign in to comment.