PageRenderTime 15ms CodeModel.GetById 9ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Examples/test-suite/d/throw_exception_runme.1.d

#
D | 30 lines | 25 code | 5 blank | 0 comment | 1 complexity | 9cd0743cbc1f5312f526aad40754c083 MD5 | raw file
 1module throw_exception_runme;
 2
 3import throw_exception.Foo;
 4
 5void main() {
 6  test!("test_int");
 7  test!("test_msg");
 8  test!("test_cls");
 9  test!("test_cls_ptr");
10  test!("test_cls_ref");
11  test!("test_cls_td");
12  test!("test_cls_ptr_td");
13  test!("test_cls_ref_td");
14  test!("test_array");
15  test!("test_enum");
16}
17
18void test(char[] methodName)() {
19  auto foo = new Foo();
20
21  bool didntThrow;
22  try {
23    mixin("foo." ~ methodName ~ "();");
24    didntThrow = true;
25  } catch (Exception) {}
26
27  if (didntThrow) {
28    throw new Exception(methodName ~ " failed");
29  }
30}