platform/packages/container/angel_container/test/lazy_test.dart
thomashii@dukefirehawk.com 5db88c8a92 Publish angel3_container
2021-05-14 15:41:25 +08:00

18 lines
404 B
Dart

import 'package:angel3_container/angel3_container.dart';
import 'package:test/test.dart';
void main() {
test('returns the same instance', () {
var container = Container(const EmptyReflector())
..registerLazySingleton<Dummy>((_) => Dummy('a'));
var first = container.make<Dummy>();
expect(container.make<Dummy>(), first);
});
}
class Dummy {
final String s;
Dummy(this.s);
}