platform/packages/container/angel_container/test/lazy_test.dart
Tobe O 9c36a7e981 Add 'packages/container/' from commit 'a7eb96a391cced0f9b2d6a9fbaffc3483c2558eb'
git-subtree-dir: packages/container
git-subtree-mainline: dd33154af1
git-subtree-split: a7eb96a391
2020-02-15 18:22:26 -05:00

18 lines
402 B
Dart

import 'package:angel_container/angel_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);
}