mirror of
https://github.com/pese-git/cherrypick.git
synced 2026-01-23 21:13:35 +00:00
30 lines
914 B
Dart
30 lines
914 B
Dart
import 'package:benchmark_harness/benchmark_harness.dart';
|
|
import 'package:benchmark_cherrypick/di_adapters/di_adapter.dart';
|
|
import 'package:benchmark_cherrypick/scenarios/parent_module.dart';
|
|
import 'package:benchmark_cherrypick/scenarios/child_override_module.dart';
|
|
import 'package:benchmark_cherrypick/scenarios/shared.dart';
|
|
import 'package:benchmark_cherrypick/scenarios/child_impl.dart';
|
|
|
|
class ScopeOverrideBenchmark extends BenchmarkBase {
|
|
final DIAdapter di;
|
|
late DIAdapter childDi;
|
|
|
|
ScopeOverrideBenchmark(this.di) : super('ScopeOverride (child overrides parent)');
|
|
|
|
@override
|
|
void setup() {
|
|
di.setupModules([ParentModule()]);
|
|
childDi = di.openSubScope('child');
|
|
childDi.setupModules([ChildOverrideModule()]);
|
|
}
|
|
|
|
@override
|
|
void teardown() => di.teardown();
|
|
|
|
@override
|
|
void run() {
|
|
final resolved = childDi.resolve<Shared>();
|
|
assert(resolved is ChildImpl);
|
|
}
|
|
}
|