Skip to content

Commit

Permalink
start playing around
Browse files Browse the repository at this point in the history
  • Loading branch information
bartekpacia committed Sep 19, 2023
1 parent 652cd51 commit d01f81a
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions packages/patrol/test/callbacks_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:patrol/src/extensions.dart';
// ignore: depend_on_referenced_packages
import 'package:test_api/src/backend/invoker.dart';

const String requestedTest = 'groupA testA';

String get currentTest => Invoker.current!.fullCurrentTestName();

void main() {
patrolSetUp(() {
print('setting up before $currentTest');
});

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

group('groupA', () {
test('testA', () {});
test('testB', () {});
test('testC', () {});
});
}

void patrolSetUp(dynamic Function() body) {
setUp(() {
final currentTest = Invoker.current!.fullCurrentTestName();

if (currentTest == requestedTest) {
body();
}
});
}

void patrolTearDown(dynamic Function() body) {
tearDown(() {
final currentTest = Invoker.current!.fullCurrentTestName();

if (currentTest == requestedTest) {
body();
}
});
}

0 comments on commit d01f81a

Please sign in to comment.