Throwing reflector tests

This commit is contained in:
Tobe O 2019-10-12 09:41:39 -04:00
parent 7cdeec36ad
commit ef57843b95

View file

@ -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!!!');
}
}