From ccdffe790116b8bb8d4dec988680f90e5058eb42 Mon Sep 17 00:00:00 2001 From: Tobe O Date: Mon, 22 Oct 2018 11:45:11 -0400 Subject: [PATCH] Lazy singleton tests --- angel_container/test/lazy_test.dart | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 angel_container/test/lazy_test.dart diff --git a/angel_container/test/lazy_test.dart b/angel_container/test/lazy_test.dart new file mode 100644 index 00000000..f52c54fc --- /dev/null +++ b/angel_container/test/lazy_test.dart @@ -0,0 +1,18 @@ +import 'package:angel_container/angel_container.dart'; +import 'package:test/test.dart'; + +void main() { + test('returns the same instance', () { + var container = new Container(const EmptyReflector()) + ..registerLazySingleton((_) => new Dummy('a')); + + var first = container.make(); + expect(container.make(), first); + }); +} + +class Dummy { + final String s; + + Dummy(this.s); +}