Skip to content

Commit cc4c313

Browse files
committed
Make (v)fprintf tests more robust
By using a separate file for each test. Also drop some unnecessary SKIPIF checks for file creation. We assume that files can be created in the test directories all over the place, so don't check for it here.
1 parent 8c2288b commit cc4c313

21 files changed

+34
-94
lines changed

ext/standard/tests/strings/fprintf_variation_001.phpt

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,13 @@
11
--TEST--
22
Test fprintf() function (variation - 1)
3-
--SKIPIF--
4-
<?php
5-
$data_file = dirname(__FILE__) . '/dump.txt';
6-
if (!($fp = fopen($data_file, 'w'))) {
7-
die('skip File dump.txt could not be created');
8-
}
9-
?>
103
--FILE--
114
<?php
125

136
$float_variation = array( "%f","%-f", "%+f", "%7.2f", "%-7.2f", "%07.2f", "%-07.2f", "%'#7.2f" );
147
$float_numbers = array( 0, 1, -1, 0.32, -0.32, 3.4. -3.4, 2.54, -2.54 );
158

169
/* creating dumping file */
17-
$data_file = dirname(__FILE__) . '/dump.txt';
10+
$data_file = dirname(__FILE__) . '/fprintf_variation_001.txt';
1811
if (!($fp = fopen($data_file, 'wt')))
1912
return;
2013

ext/standard/tests/strings/fprintf_variation_002.phpt

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,13 @@
11
--TEST--
22
Test fprintf() function (variation - 2)
3-
--SKIPIF--
4-
<?php
5-
$data_file = dirname(__FILE__) . '/dump.txt';
6-
if (!($fp = fopen($data_file, 'w'))) {
7-
die('skip File dump.txt could not be created');
8-
}
9-
?>
103
--FILE--
114
<?php
125

136
$int_variation = array( "%d", "%-d", "%+d", "%7.2d", "%-7.2d", "%07.2d", "%-07.2d", "%'#7.2d" );
147
$int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" );
158

169
/* creating dumping file */
17-
$data_file = dirname(__FILE__) . '/dump.txt';
10+
$data_file = dirname(__FILE__) . '/fprintf_variation_002.txt';
1811
if (!($fp = fopen($data_file, 'wt')))
1912
return;
2013

ext/standard/tests/strings/fprintf_variation_003.phpt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
Test fprintf() function (variation - 3)
33
--SKIPIF--
44
<?php
5-
$data_file = dirname(__FILE__) . '/dump.txt';
6-
if (!($fp = fopen($data_file, 'w'))) {
7-
die('skip File dump.txt could not be created');
8-
}
95
if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
106
?>
117
--FILE--
@@ -14,7 +10,7 @@ if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
1410
$int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" );
1511

1612
/* creating dumping file */
17-
$data_file = dirname(__FILE__) . '/dump.txt';
13+
$data_file = dirname(__FILE__) . '/fprintf_variation_003.txt';
1814
if (!($fp = fopen($data_file, 'wt')))
1915
return;
2016

ext/standard/tests/strings/fprintf_variation_003_64bit.phpt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
Test fprintf() function (variation - 3)
33
--SKIPIF--
44
<?php
5-
$data_file = dirname(__FILE__) . '/dump.txt';
6-
if (!($fp = fopen($data_file, 'w'))) {
7-
die('skip File dump.txt could not be created');
8-
}
95
if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
106
?>
117
--FILE--
@@ -14,7 +10,7 @@ if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
1410
$int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" );
1511

1612
/* creating dumping file */
17-
$data_file = dirname(__FILE__) . '/dump.txt';
13+
$data_file = dirname(__FILE__) . '/fprintf_variation_003_64bit.txt';
1814
if (!($fp = fopen($data_file, 'wt')))
1915
return;
2016

Binary file not shown.

ext/standard/tests/strings/fprintf_variation_005.phpt

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
11
--TEST--
22
Test fprintf() function (variation - 5)
3-
--SKIPIF--
4-
<?php
5-
$data_file = dirname(__FILE__) . '/dump.txt';
6-
if (!($fp = fopen($data_file, 'w'))) {
7-
die('skip File dump.txt could not be created');
8-
}
9-
?>
103
--FILE--
114
<?php
125

136
$int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" );
147

158
/* creating dumping file */
16-
$data_file = dirname(__FILE__) . '/dump.txt';
9+
$data_file = dirname(__FILE__) . '/fprintf_variation_005.txt';
1710
if (!($fp = fopen($data_file, 'wt')))
1811
return;
1912

ext/standard/tests/strings/fprintf_variation_006.phpt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
Test fprintf() function (variation - 6)
33
--SKIPIF--
44
<?php
5-
$data_file = dirname(__FILE__) . '/dump.txt';
6-
if (!($fp = fopen($data_file, 'w'))) {
7-
die('skip File dump.txt could not be created');
8-
}
95
if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
106
?>
117
--FILE--
@@ -14,7 +10,7 @@ if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
1410
$int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" );
1511

1612
/* creating dumping file */
17-
$data_file = dirname(__FILE__) . '/dump.txt';
13+
$data_file = dirname(__FILE__) . '/fprintf_variation_006.txt';
1814
if (!($fp = fopen($data_file, 'wt')))
1915
return;
2016

ext/standard/tests/strings/fprintf_variation_006_64bit.phpt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
Test fprintf() function (variation - 6)
33
--SKIPIF--
44
<?php
5-
$data_file = dirname(__FILE__) . '/dump.txt';
6-
if (!($fp = fopen($data_file, 'w'))) {
7-
die('skip File dump.txt could not be created');
8-
}
95
if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
106
?>
117
--FILE--
@@ -14,7 +10,7 @@ if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
1410
$int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" );
1511

1612
/* creating dumping file */
17-
$data_file = dirname(__FILE__) . '/dump.txt';
13+
$data_file = dirname(__FILE__) . '/fprintf_variation_006_64bit.txt';
1814
if (!($fp = fopen($data_file, 'wt')))
1915
return;
2016

ext/standard/tests/strings/fprintf_variation_007.phpt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
Test fprintf() function (variation - 7)
33
--SKIPIF--
44
<?php
5-
$data_file = dirname(__FILE__) . '/dump.txt';
6-
if (!($fp = fopen($data_file, 'w'))) {
7-
die('skip File dump.txt could not be created');
8-
}
95
if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
106
?>
117
--FILE--
@@ -14,7 +10,7 @@ if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
1410
$int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" );
1511

1612
/* creating dumping file */
17-
$data_file = dirname(__FILE__) . '/dump.txt';
13+
$data_file = dirname(__FILE__) . '/fprintf_variation_007.txt';
1814
if (!($fp = fopen($data_file, 'wt')))
1915
return;
2016

ext/standard/tests/strings/fprintf_variation_007_64bit.phpt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
Test fprintf() function (variation - 7)
33
--SKIPIF--
44
<?php
5-
$data_file = dirname(__FILE__) . '/dump.txt';
6-
if (!($fp = fopen($data_file, 'w'))) {
7-
die('skip File dump.txt could not be created');
8-
}
95
if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
106
?>
117
--FILE--
@@ -14,7 +10,7 @@ if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
1410
$int_numbers = array( 0, 1, -1, 2.7, -2.7, 23333333, -23333333, "1234" );
1511

1612
/* creating dumping file */
17-
$data_file = dirname(__FILE__) . '/dump.txt';
13+
$data_file = dirname(__FILE__) . '/fprintf_variation_007_64bit.txt';
1814
if (!($fp = fopen($data_file, 'wt')))
1915
return;
2016

0 commit comments

Comments
 (0)