mirror of
https://github.com/danog/ext-uv.git
synced 2024-11-30 04:29:01 +01:00
fix uv_cwd
This commit is contained in:
parent
6e22f44f26
commit
9a0624ecfc
3
php_uv.c
3
php_uv.c
@ -3005,11 +3005,10 @@ PHP_FUNCTION(uv_cwd)
|
||||
char buffer[1024] = {0};
|
||||
size_t buffer_sz = sizeof(buffer);
|
||||
|
||||
/* TODO: check behavior */
|
||||
uv_cwd(buffer, &buffer_sz);
|
||||
buffer[buffer_sz] = '\0';
|
||||
|
||||
RETURN_STRINGL(buffer, buffer_sz, 1);
|
||||
RETURN_STRING(buffer, 1);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
15
tests/999-uv_chdir.phpt
Normal file
15
tests/999-uv_chdir.phpt
Normal file
@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
Check for uv_chdir
|
||||
--FILE--
|
||||
<?php
|
||||
@uv_chdir(); // don't SEGV
|
||||
|
||||
uv_chdir(dirname(__FILE__));
|
||||
if (uv_cwd() == dirname(__FILE__)) {
|
||||
echo "OK";
|
||||
} else {
|
||||
echo "FAILED: expected " . dirname(__FILE__) . ", but " . uv_cwd();
|
||||
}
|
||||
|
||||
--EXPECT--
|
||||
OK
|
16
tests/999-uv_cwd.phpt
Normal file
16
tests/999-uv_cwd.phpt
Normal file
@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Check for uv_cwd
|
||||
--FILE--
|
||||
<?php
|
||||
$cwd = uv_cwd();
|
||||
|
||||
$expected = getcwd();
|
||||
|
||||
if ($cwd == $expected) {
|
||||
echo "OK" . PHP_EOL;
|
||||
} else {
|
||||
echo "FAILED: expected {$expected}, but {$cwd}" . PHP_EOL;
|
||||
|
||||
}
|
||||
--EXPECT--
|
||||
OK
|
Loading…
Reference in New Issue
Block a user