diff options
author | Saúl Ibarra Corretgé <saghul@gmail.com> | 2015-06-03 21:18:55 +0200 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2015-06-04 00:09:05 +0200 |
commit | aa33db32380fe05a3bc7a2e320bbf63a6adddf08 (patch) | |
tree | 6794c5f2c1a46e1e319f50860bf4b7d558b24587 /deps/uv/test/test-homedir.c | |
parent | a804026c9b5b9f8d6316fd5e9fdb9f96f7e1c6b3 (diff) | |
download | android-node-v8-aa33db32380fe05a3bc7a2e320bbf63a6adddf08.tar.gz android-node-v8-aa33db32380fe05a3bc7a2e320bbf63a6adddf08.tar.bz2 android-node-v8-aa33db32380fe05a3bc7a2e320bbf63a6adddf08.zip |
deps: update libuv to version 1.6.0
Fixes: https://github.com/joyent/node/issues/9310
PR-URL: https://github.com/nodejs/io.js/pull/1889
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'deps/uv/test/test-homedir.c')
-rw-r--r-- | deps/uv/test/test-homedir.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/deps/uv/test/test-homedir.c b/deps/uv/test/test-homedir.c new file mode 100644 index 0000000000..cbc47566c5 --- /dev/null +++ b/deps/uv/test/test-homedir.c @@ -0,0 +1,49 @@ +#include "uv.h" +#include "task.h" +#include <string.h> + +#define PATHMAX 1024 +#define SMALLPATH 1 + +TEST_IMPL(homedir) { + char homedir[PATHMAX]; + size_t len; + char last; + int r; + + /* Test the normal case */ + len = sizeof homedir; + homedir[0] = '\0'; + ASSERT(strlen(homedir) == 0); + r = uv_os_homedir(homedir, &len); + ASSERT(r == 0); + ASSERT(strlen(homedir) == len); + ASSERT(len > 0); + ASSERT(homedir[len] == '\0'); + + if (len > 1) { + last = homedir[len - 1]; +#ifdef _WIN32 + ASSERT(last != '\\'); +#else + ASSERT(last != '/'); +#endif + } + + /* Test the case where the buffer is too small */ + len = SMALLPATH; + r = uv_os_homedir(homedir, &len); + ASSERT(r == UV_ENOBUFS); + ASSERT(len > SMALLPATH); + + /* Test invalid inputs */ + r = uv_os_homedir(NULL, &len); + ASSERT(r == UV_EINVAL); + r = uv_os_homedir(homedir, NULL); + ASSERT(r == UV_EINVAL); + len = 0; + r = uv_os_homedir(homedir, &len); + ASSERT(r == UV_EINVAL); + + return 0; +} |