summaryrefslogtreecommitdiff
path: root/Examples/test-suite/d/throw_exception_runme.2.d
diff options
context:
space:
mode:
Diffstat (limited to 'Examples/test-suite/d/throw_exception_runme.2.d')
-rw-r--r--Examples/test-suite/d/throw_exception_runme.2.d30
1 files changed, 30 insertions, 0 deletions
diff --git a/Examples/test-suite/d/throw_exception_runme.2.d b/Examples/test-suite/d/throw_exception_runme.2.d
new file mode 100644
index 000000000..6fc82a93d
--- /dev/null
+++ b/Examples/test-suite/d/throw_exception_runme.2.d
@@ -0,0 +1,30 @@
+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");
+ }
+}