/trunk/Examples/test-suite/d/throw_exception_runme.2.d
D | 30 lines | 25 code | 5 blank | 0 comment | 1 complexity | 4caa60e24c20c447649843cc2c0839d8 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
- module throw_exception_runme;
- import throw_exception.Foo;
- void main() {
- test!("test_int");
- test!("test_msg");
- test!("test_cls");
- test!("test_cls_ptr");
- test!("test_cls_ref");
- test!("test_cls_td");
- test!("test_cls_ptr_td");
- test!("test_cls_ref_td");
- test!("test_array");
- test!("test_enum");
- }
- void test(string methodName)() {
- auto foo = new Foo();
- bool didntThrow;
- try {
- mixin("foo." ~ methodName ~ "();");
- didntThrow = true;
- } catch (Exception) {}
- if (didntThrow) {
- throw new Exception(methodName ~ " failed");
- }
- }