1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Merge readline tests for POSIX and Windows (GH-17171)

These test cases differ only in some details, so it doesn't make much
sense to have separate test cases, given that POSIX/Windows test pairs
are not unlikely to diverge over time (as can be seen here, where the
POSIX tests are skipped for repeat runs, but the Windows tests are
not).
This commit is contained in:
Christoph M. Becker
2024-12-16 13:46:44 +01:00
committed by GitHub
parent 7e1a241b09
commit 75410eb457
4 changed files with 7 additions and 91 deletions

View File

@@ -1,43 +0,0 @@
--TEST--
readline_info(): Basic test
--EXTENSIONS--
readline
--SKIPIF--
<?php if (READLINE_LIB != "libedit") die("skip libedit only");
if(substr(PHP_OS, 0, 3) != 'WIN' ) {
die('skip windows only test');
}
?>
--FILE--
<?php
var_dump(readline_info());
var_dump(readline_info(1));
var_dump(readline_info(1,1));
var_dump(readline_info('line_buffer'));
var_dump(readline_info('readline_name'));
var_dump(readline_info('readline_name', 1));
var_dump(readline_info('readline_name'));
var_dump(readline_info('attempted_completion_over',1));
var_dump(readline_info('attempted_completion_over'));
?>
--EXPECT--
array(4) {
["line_buffer"]=>
string(0) ""
["point"]=>
int(0)
["readline_name"]=>
string(0) ""
["attempted_completion_over"]=>
int(0)
}
NULL
NULL
string(0) ""
string(0) ""
string(0) ""
string(1) "1"
int(0)
int(1)

View File

@@ -4,9 +4,6 @@ readline_info(): Basic test
readline
--SKIPIF--
<?php if (READLINE_LIB != "libedit") die("skip libedit only");
if(substr(PHP_OS, 0, 3) == 'WIN' ) {
die('skip not for windows');
}
if (getenv('SKIP_REPEAT')) die("skip readline has global state");
?>
--FILE--
@@ -28,11 +25,7 @@ array(%d) {
["line_buffer"]=>
string(0) ""
["point"]=>
int(0)
["end"]=>
int(0)%A
["library_version"]=>
string(%d) "%s"
["readline_name"]=>
string(0) ""
["attempted_completion_over"]=>

View File

@@ -1,30 +0,0 @@
--TEST--
readline_write_history(): Basic test
--EXTENSIONS--
readline
--SKIPIF--
<?php if (!function_exists('readline_add_history')) die("skip");
if (READLINE_LIB != "libedit") die("skip libedit only");
if(substr(PHP_OS, 0, 3) != 'WIN' ) {
die('skip windows only test');
}
?>
--FILE--
<?php
$name = tempnam(sys_get_temp_dir(), 'readline.tmp');
readline_add_history('foo');
readline_add_history('');
readline_add_history(1);
readline_write_history($name);
var_dump(file_get_contents($name));
unlink($name);
?>
--EXPECT--
string(6) "foo
1
"

View File

@@ -5,29 +5,25 @@ readline
--SKIPIF--
<?php if (!function_exists('readline_add_history')) die("skip");
if (READLINE_LIB != "libedit") die("skip libedit only");
if(substr(PHP_OS, 0, 3) == 'WIN' ) {
die('skip not for windows');
}
if (getenv('SKIP_REPEAT')) die("skip readline has global state");
?>
--FILE--
<?php
$name = tempnam('/tmp', 'readline.tmp');
$name = tempnam(sys_get_temp_dir(), 'readline.tmp');
readline_add_history('foo');
readline_add_history('');
readline_add_history(1);
readline_write_history($name);
var_dump(file_get_contents($name));
echo(file_get_contents($name));
unlink($name);
?>
--EXPECT--
string(20) "_HiStOrY_V2_
foo
1
"
--EXPECTREGEX--
(_HiStOrY_V2_
)?foo
(
)?1