summaryrefslogtreecommitdiff
path: root/ext/shmop
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-02-03 22:52:20 +0100
committerNikita Popov <nikita.ppv@gmail.com>2020-02-03 22:52:20 +0100
commitf8d795820e780a6322e054c26c581570613c14f0 (patch)
tree99d3ae01ce564752807341c5743863b4c92513f8 /ext/shmop
parentd2cb200e10ada6fa44c54a29292bb4665728fff0 (diff)
downloadphp-git-f8d795820e780a6322e054c26c581570613c14f0.tar.gz
Reindent phpt files
Diffstat (limited to 'ext/shmop')
-rw-r--r--ext/shmop/tests/001.phpt106
-rw-r--r--ext/shmop/tests/002.phpt46
2 files changed, 76 insertions, 76 deletions
diff --git a/ext/shmop/tests/001.phpt b/ext/shmop/tests/001.phpt
index 471f82cbda..48e722d2f0 100644
--- a/ext/shmop/tests/001.phpt
+++ b/ext/shmop/tests/001.phpt
@@ -8,73 +8,73 @@ shmop extension test
?>
--FILE--
<?php
- $hex_shm_id = 0xff3;
- $write_d1 = "test #1 of the shmop() extension";
- $write_d2 = "test #2 append data to shared memory segment";
+ $hex_shm_id = 0xff3;
+ $write_d1 = "test #1 of the shmop() extension";
+ $write_d2 = "test #2 append data to shared memory segment";
- echo "shm open for create: ";
- $shm_id = shmop_open($hex_shm_id, "n", 0644, 1024);
- if (!$shm_id) {
- die("failed\n");
- } else {
- echo "ok\n";
- }
+ echo "shm open for create: ";
+ $shm_id = shmop_open($hex_shm_id, "n", 0644, 1024);
+ if (!$shm_id) {
+ die("failed\n");
+ } else {
+ echo "ok\n";
+ }
- echo "shm size is: " . ($shm_size = shmop_size($shm_id)) . "\n";
+ echo "shm size is: " . ($shm_size = shmop_size($shm_id)) . "\n";
- echo "shm write test #1: ";
- $written = shmop_write($shm_id, $write_d1, 0);
- if ($written != strlen($write_d1)) {
- echo "failed\n";
- } else {
- echo "ok\n";
- }
+ echo "shm write test #1: ";
+ $written = shmop_write($shm_id, $write_d1, 0);
+ if ($written != strlen($write_d1)) {
+ echo "failed\n";
+ } else {
+ echo "ok\n";
+ }
- echo "data in memory is: " . shmop_read($shm_id, 0, $written) . "\n";
+ echo "data in memory is: " . shmop_read($shm_id, 0, $written) . "\n";
- shmop_close($shm_id);
+ shmop_close($shm_id);
- echo "shm open for read only: ";
- $shm_id = shmop_open($hex_shm_id, "a", 0644, 1024);
- if (!$shm_id) {
- echo "failed\n";
- } else {
- echo "ok\n";
- }
+ echo "shm open for read only: ";
+ $shm_id = shmop_open($hex_shm_id, "a", 0644, 1024);
+ if (!$shm_id) {
+ echo "failed\n";
+ } else {
+ echo "ok\n";
+ }
- echo "data in memory is: " . shmop_read($shm_id, 0, $written) . "\n";
+ echo "data in memory is: " . shmop_read($shm_id, 0, $written) . "\n";
- /* try to append data to the shared memory segment, this should fail */
- shmop_write($shm_id, $write_d1, $written);
+ /* try to append data to the shared memory segment, this should fail */
+ shmop_write($shm_id, $write_d1, $written);
- shmop_close($shm_id);
+ shmop_close($shm_id);
- echo "shm open for read only: ";
- $shm_id = shmop_open($hex_shm_id, "w", 0644, 1024);
- if (!$shm_id) {
- echo "failed\n";
- } else {
- echo "ok\n";
- }
+ echo "shm open for read only: ";
+ $shm_id = shmop_open($hex_shm_id, "w", 0644, 1024);
+ if (!$shm_id) {
+ echo "failed\n";
+ } else {
+ echo "ok\n";
+ }
- echo "shm write test #1: ";
- $written = shmop_write($shm_id, $write_d2, $written);
- if ($written != strlen($write_d2)) {
- die("failed\n");
- } else {
- echo "ok\n";
- }
+ echo "shm write test #1: ";
+ $written = shmop_write($shm_id, $write_d2, $written);
+ if ($written != strlen($write_d2)) {
+ die("failed\n");
+ } else {
+ echo "ok\n";
+ }
- echo "data in memory is: " . shmop_read($shm_id, 0, strlen($write_d1 . $write_d2)) . "\n";
+ echo "data in memory is: " . shmop_read($shm_id, 0, strlen($write_d1 . $write_d2)) . "\n";
- echo "deletion of shm segment: ";
- if (!shmop_delete($shm_id)) {
- echo "failed\n";
- } else {
- echo "ok\n";
- }
+ echo "deletion of shm segment: ";
+ if (!shmop_delete($shm_id)) {
+ echo "failed\n";
+ } else {
+ echo "ok\n";
+ }
- shmop_close($shm_id);
+ shmop_close($shm_id);
?>
--EXPECTF--
shm open for create: ok
diff --git a/ext/shmop/tests/002.phpt b/ext/shmop/tests/002.phpt
index 12b1b6b95f..c69c79391f 100644
--- a/ext/shmop/tests/002.phpt
+++ b/ext/shmop/tests/002.phpt
@@ -13,39 +13,39 @@ edgarsandi - <edgar.r.sandi@gmail.com>
?>
--FILE--
<?php
- $hex_shm_id = function(){
- return mt_rand(1338, 9999);
- };
+ $hex_shm_id = function(){
+ return mt_rand(1338, 9999);
+ };
echo PHP_EOL, '## shmop_open function tests ##';
- // warning outputs: invalid flag when the flags length != 1
- var_dump(shmop_open($hex_shm_id(), '', 0644, 1024));
+ // warning outputs: invalid flag when the flags length != 1
+ var_dump(shmop_open($hex_shm_id(), '', 0644, 1024));
- // warning outputs: invalid access mode
- var_dump(shmop_open($hex_shm_id(), 'b', 0644, 1024));
+ // warning outputs: invalid access mode
+ var_dump(shmop_open($hex_shm_id(), 'b', 0644, 1024));
- // warning outputs: unable to attach or create shared memory segment
- var_dump(shmop_open(null, 'a', 0644, 1024));
+ // warning outputs: unable to attach or create shared memory segment
+ var_dump(shmop_open(null, 'a', 0644, 1024));
- // warning outputs: Shared memory segment size must be greater than zero
- var_dump(shmop_open($hex_shm_id(), "c", 0666, 0));
+ // warning outputs: Shared memory segment size must be greater than zero
+ var_dump(shmop_open($hex_shm_id(), "c", 0666, 0));
echo PHP_EOL, '## shmop_read function tests ##';
- // warning outputs: start is out of range
- $shm_id = shmop_open($hex_shm_id(), 'n', 0600, 1024);
- var_dump(shmop_read($shm_id, -10, 0));
- shmop_delete($shm_id);
+ // warning outputs: start is out of range
+ $shm_id = shmop_open($hex_shm_id(), 'n', 0600, 1024);
+ var_dump(shmop_read($shm_id, -10, 0));
+ shmop_delete($shm_id);
- // warning outputs: count is out of range
- $shm_id = shmop_open($hex_shm_id(), 'n', 0600, 1024);
- var_dump(shmop_read($shm_id, 0, -10));
- shmop_delete($shm_id);
+ // warning outputs: count is out of range
+ $shm_id = shmop_open($hex_shm_id(), 'n', 0600, 1024);
+ var_dump(shmop_read($shm_id, 0, -10));
+ shmop_delete($shm_id);
echo PHP_EOL, '## shmop_write function tests ##';
- // warning outputs: offset out of range
- $shm_id = shmop_open($hex_shm_id(), 'n', 0600, 1024);
- var_dump(shmop_write($shm_id, 'text to try write', -10));
- shmop_delete($shm_id);
+ // warning outputs: offset out of range
+ $shm_id = shmop_open($hex_shm_id(), 'n', 0600, 1024);
+ var_dump(shmop_write($shm_id, 'text to try write', -10));
+ shmop_delete($shm_id);
?>
--EXPECTF--
## shmop_open function tests ##