aboutsummaryrefslogtreecommitdiff
path: root/Examples/test-suite/d/catches_strings_runme.2.d
diff options
context:
space:
mode:
authorAlistair Delva <adelva@google.com>2024-04-10 14:15:29 -0700
committerAlistair Delva <adelva@google.com>2024-04-11 12:58:28 -0700
commitd0f0f90be16c2ac553b5fa08512045273135147a (patch)
tree5d9ebb7a04807ea8a609ddd18b0162bc87530e4b /Examples/test-suite/d/catches_strings_runme.2.d
parent6ffc1dbf29ba98c4d8aa71ebc9b484e973fe1030 (diff)
downloadswig-d0f0f90be16c2ac553b5fa08512045273135147a.tar.gz
Change-Id: I47cef2be94299220d80265d949a95b58eee2c23b
Diffstat (limited to 'Examples/test-suite/d/catches_strings_runme.2.d')
-rw-r--r--Examples/test-suite/d/catches_strings_runme.2.d32
1 files changed, 32 insertions, 0 deletions
diff --git a/Examples/test-suite/d/catches_strings_runme.2.d b/Examples/test-suite/d/catches_strings_runme.2.d
new file mode 100644
index 000000000..89108355b
--- /dev/null
+++ b/Examples/test-suite/d/catches_strings_runme.2.d
@@ -0,0 +1,32 @@
+module catches_strings_runme;
+
+import catches_strings.catches_strings;
+import catches_strings.StringsThrower;
+import std.algorithm;
+
+void main() {
+ {
+ bool exception_thrown = false;
+ try {
+ StringsThrower.charstring();
+ } catch (Exception e) {
+ if (!canFind(e.msg, "charstring message"))
+ throw new Exception("incorrect exception message:" ~ e.msg);
+ exception_thrown = true;
+ }
+ if (!exception_thrown)
+ throw new Exception("Should have thrown an exception");
+ }
+ {
+ bool exception_thrown = false;
+ try {
+ StringsThrower.stdstring();
+ } catch (Exception e) {
+ if (!canFind(e.msg, "stdstring message"))
+ throw new Exception("incorrect exception message:" ~ e.msg);
+ exception_thrown = true;
+ }
+ if (!exception_thrown)
+ throw new Exception("Should have thrown an exception");
+ }
+}