From ef57843b95ffcacf1644fe582eaae9e23de37721 Mon Sep 17 00:00:00 2001 From: Tobe O Date: Sat, 12 Oct 2019 09:41:39 -0400 Subject: [PATCH] Throwing reflector tests --- .../test/throwing_reflector_test.dart | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 angel_container/test/throwing_reflector_test.dart diff --git a/angel_container/test/throwing_reflector_test.dart b/angel_container/test/throwing_reflector_test.dart new file mode 100644 index 00000000..3125f709 --- /dev/null +++ b/angel_container/test/throwing_reflector_test.dart @@ -0,0 +1,36 @@ +import 'package:angel_container/angel_container.dart'; +import 'package:test/test.dart'; + +void main() { + var reflector = const ThrowingReflector(); + + test('getName', () { + expect(reflector.getName(#foo), 'foo'); + expect(reflector.getName(#==), '=='); + }); + + test('reflectClass fails', () { + expect(() => reflector.reflectClass(Truck), throwsUnsupportedError); + }); + + test('reflectType fails', () { + expect(() => reflector.reflectType(Truck), throwsUnsupportedError); + }); + + test('reflectFunction throws', () { + void doIt(int x) {} + expect(() => reflector.reflectFunction(doIt), throwsUnsupportedError); + }); + + test('reflectInstance throws', () { + expect(() => reflector.reflectInstance(Truck()), throwsUnsupportedError); + }); +} + +class Truck { + int get wheelCount => 4; + + void drive() { + print('Vroom!!!'); + } +}