summaryrefslogtreecommitdiff
path: root/Examples
diff options
context:
space:
mode:
Diffstat (limited to 'Examples')
-rw-r--r--Examples/test-suite/php/catches_strings_runme.php4
-rw-r--r--Examples/test-suite/php/li_std_string_runme.php26
2 files changed, 28 insertions, 2 deletions
diff --git a/Examples/test-suite/php/catches_strings_runme.php b/Examples/test-suite/php/catches_strings_runme.php
index f727ea26a..758c3f618 100644
--- a/Examples/test-suite/php/catches_strings_runme.php
+++ b/Examples/test-suite/php/catches_strings_runme.php
@@ -6,7 +6,7 @@ $exception_thrown = false;
try {
StringsThrower::charstring();
} catch (Exception $e) {
- check::str_contains($e->getMessage(), "charstring message", "incorrect exception message: {$e->getMessage()}");
+ check::equal($e->getMessage(), "charstring message", "incorrect exception message: {$e->getMessage()}");
$exception_thrown = true;
}
check::equal($exception_thrown, true, "Should have thrown an exception");
@@ -15,7 +15,7 @@ $exception_thrown = false;
try {
StringsThrower::stdstring();
} catch (Exception $e) {
- check::str_contains($e->getMessage(), "stdstring message", "incorrect exception message: {$e->getMessage()}");
+ check::equal($e->getMessage(), "stdstring message", "incorrect exception message: {$e->getMessage()}");
$exception_thrown = true;
}
check::equal($exception_thrown, true, "Should have thrown an exception");
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");