test: fix cwd_and_chdir test on Unix
There is no need to check for a trailing slash, uv_cwd ensures it. PR-URL: https://github.com/libuv/libuv/pull/63 Reviewed-By: Bert Belder <bertbelder@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This commit is contained in:
parent
d4d1f32858
commit
37daffaccb
@ -31,28 +31,12 @@ TEST_IMPL(cwd_and_chdir) {
|
||||
char buffer_new[PATHMAX];
|
||||
size_t size1;
|
||||
size_t size2;
|
||||
char* last_slash;
|
||||
int err;
|
||||
|
||||
size1 = sizeof buffer_orig;
|
||||
err = uv_cwd(buffer_orig, &size1);
|
||||
ASSERT(err == 0);
|
||||
|
||||
/* Remove trailing slash unless at a root directory. */
|
||||
#ifdef _WIN32
|
||||
last_slash = strrchr(buffer_orig, '\\');
|
||||
ASSERT(last_slash);
|
||||
if (last_slash > buffer_orig && *(last_slash - 1) != ':') {
|
||||
*last_slash = '\0';
|
||||
}
|
||||
#else /* Unix */
|
||||
last_slash = strrchr(buffer_orig, '/');
|
||||
ASSERT(last_slash);
|
||||
if (last_slash != buffer_orig) {
|
||||
*last_slash = '\0';
|
||||
}
|
||||
#endif
|
||||
|
||||
err = uv_chdir(buffer_orig);
|
||||
ASSERT(err == 0);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user