Skip to content

Commit d161e96

Browse files
authored
feat: Add tests for new_persistent function in ZString integration (#205)
1 parent 57cfa79 commit d161e96

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

tests/integration/src/strings.rs

+17
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,21 @@ pub fn integrate(module: &mut Module) {
2525
Ok(())
2626
},
2727
);
28+
29+
module.add_function(
30+
"integrate_strings_zend_string_new_persistent",
31+
|_: &mut [ZVal]| -> phper::Result<()> {
32+
let zs = ZString::new_persistent("persistent_hello");
33+
assert_eq!(zs.to_str()?, "persistent_hello");
34+
35+
let zs = ZString::new_persistent([4, 5, 6]);
36+
assert_eq!(zs.as_ref(), &[4, 5, 6]);
37+
38+
assert!(
39+
ZString::new_persistent("persistent") == ZString::new_persistent(b"persistent")
40+
);
41+
42+
Ok(())
43+
},
44+
);
2845
}

tests/integration/tests/php/strings.php

+1
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@
1414
require_once __DIR__ . '/_common.php';
1515

1616
integrate_strings_zend_string_new();
17+
integrate_strings_zend_string_new_persistent();

0 commit comments

Comments
 (0)