summaryrefslogtreecommitdiff
path: root/Examples
diff options
context:
space:
mode:
authorOlly Betts <olly@survex.com>2023-04-24 12:17:19 +1200
committerOlly Betts <olly@survex.com>2023-04-24 12:18:52 +1200
commitd45884bab5a881cb1420625ad27c5fccb5b4f6b1 (patch)
tree68c45e180d556d343f36e03c4f04560f7ce7fa0b /Examples
parent01b6268b303919739f15a8681b898e2e65b84cc9 (diff)
downloadswig-d45884bab5a881cb1420625ad27c5fccb5b4f6b1.tar.gz
[php] Add throws typemaps for string* + const string*
Diffstat (limited to 'Examples')
-rw-r--r--Examples/test-suite/php/li_std_string_runme.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/Examples/test-suite/php/li_std_string_runme.php b/Examples/test-suite/php/li_std_string_runme.php
index 169f947a7..390b7e17b 100644
--- a/Examples/test-suite/php/li_std_string_runme.php
+++ b/Examples/test-suite/php/li_std_string_runme.php
@@ -67,6 +67,32 @@ $s = "byref";
check::equal(li_std_string::test_reference_php($s), null);
check::equal($s, "byref.php");
+// Test throwing strings:
+try {
+ test_throw();
+ check::fail("test_throw() didn't throw");
+} catch (Exception $s) {
+ check::equal($s->getMessage(), "test_throw message");
+}
+try {
+ test_const_reference_throw();
+ check::fail("test_const_reference_throw() didn't throw");
+} catch (Exception $s) {
+ check::equal($s->getMessage(), "test_const_reference_throw message");
+}
+try {
+ test_pointer_throw();
+ check::fail("test_pointer_throw() didn't throw");
+} catch (Exception $s) {
+ check::equal($s->getMessage(), "foo");
+}
+try {
+ test_const_pointer_throw();
+ check::fail("test_const_pointer_throw() didn't throw");
+} catch (Exception $s) {
+ check::equal($s->getMessage(), "foo");
+}
+
// This used to give "Undefined variable: r"
li_std_string::test_const_reference_returning_void("foo");