summaryrefslogtreecommitdiff
path: root/deps/uv/test/test-fs.c
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2012-10-06 23:04:30 +0200
committerBen Noordhuis <info@bnoordhuis.nl>2012-10-07 00:44:38 +0200
commitee77a6a953c65ff1fddf4017496387c42dd84d63 (patch)
treee87fedec086f8411ac52027c6a7570f60e30bd1d /deps/uv/test/test-fs.c
parent836a06fc4f4920d5e9675763290c97aa4e7288fe (diff)
downloadandroid-node-v8-ee77a6a953c65ff1fddf4017496387c42dd84d63.tar.gz
android-node-v8-ee77a6a953c65ff1fddf4017496387c42dd84d63.tar.bz2
android-node-v8-ee77a6a953c65ff1fddf4017496387c42dd84d63.zip
deps: upgrade libuv to b9ed1a6
Diffstat (limited to 'deps/uv/test/test-fs.c')
-rw-r--r--deps/uv/test/test-fs.c38
1 files changed, 36 insertions, 2 deletions
diff --git a/deps/uv/test/test-fs.c b/deps/uv/test/test-fs.c
index 76ced14a94..e59e5ed11d 100644
--- a/deps/uv/test/test-fs.c
+++ b/deps/uv/test/test-fs.c
@@ -53,6 +53,7 @@ typedef struct {
} utime_check_t;
+static int dummy_cb_count;
static int close_cb_count;
static int create_cb_count;
static int open_cb_count;
@@ -127,6 +128,12 @@ void check_permission(const char* filename, int mode) {
}
+static void dummy_cb(uv_fs_t* req) {
+ (void) req;
+ dummy_cb_count++;
+}
+
+
static void link_cb(uv_fs_t* req) {
ASSERT(req->fs_type == UV_FS_LINK);
ASSERT(req->result == 0);
@@ -787,7 +794,7 @@ TEST_IMPL(fs_async_dir) {
ASSERT(r == 0);
uv_run(loop);
- r = uv_fs_stat(loop, &stat_req, "test_dir\\", stat_cb);
+ r = uv_fs_stat(loop, &stat_req, "test_dir/", stat_cb);
ASSERT(r == 0);
uv_run(loop);
@@ -795,7 +802,7 @@ TEST_IMPL(fs_async_dir) {
ASSERT(r == 0);
uv_run(loop);
- r = uv_fs_lstat(loop, &stat_req, "test_dir\\", stat_cb);
+ r = uv_fs_lstat(loop, &stat_req, "test_dir/", stat_cb);
ASSERT(r == 0);
uv_run(loop);
@@ -1183,6 +1190,28 @@ TEST_IMPL(fs_link) {
}
+TEST_IMPL(fs_readlink) {
+ uv_fs_t req;
+
+ loop = uv_default_loop();
+ ASSERT(0 == uv_fs_readlink(loop, &req, "no_such_file", dummy_cb));
+ ASSERT(0 == uv_run(loop));
+ ASSERT(dummy_cb_count == 1);
+ ASSERT(req.ptr == NULL);
+ ASSERT(req.result == -1);
+ ASSERT(req.errorno == UV_ENOENT);
+ uv_fs_req_cleanup(&req);
+
+ ASSERT(-1 == uv_fs_readlink(loop, &req, "no_such_file", NULL));
+ ASSERT(req.ptr == NULL);
+ ASSERT(req.result == -1);
+ ASSERT(req.errorno == UV_ENOENT);
+ uv_fs_req_cleanup(&req);
+
+ return 0;
+}
+
+
TEST_IMPL(fs_symlink) {
int r;
uv_fs_t req;
@@ -1251,6 +1280,8 @@ TEST_IMPL(fs_symlink) {
r = uv_fs_symlink(loop, &req, "test_file_symlink", "test_file_symlink_symlink", 0, NULL);
ASSERT(r != -1);
+ uv_fs_req_cleanup(&req);
+
r = uv_fs_readlink(loop, &req, "test_file_symlink_symlink", NULL);
ASSERT(r != -1);
ASSERT(strcmp(req.ptr, "test_file_symlink") == 0);
@@ -1278,6 +1309,8 @@ TEST_IMPL(fs_symlink) {
r = uv_fs_symlink(loop, &req, "test_file_symlink2", "test_file_symlink2_symlink", 0, NULL);
ASSERT(r != -1);
+ uv_fs_req_cleanup(&req);
+
r = uv_fs_readlink(loop, &req, "test_file_symlink2_symlink", readlink_cb);
ASSERT(r != -1);
uv_run(loop);
@@ -1608,6 +1641,7 @@ TEST_IMPL(fs_readdir_file) {
r = uv_fs_readdir(loop, &readdir_req, path, 0, NULL);
ASSERT(r == -1);
ASSERT(uv_last_error(loop).code == UV_ENOTDIR);
+ uv_fs_req_cleanup(&readdir_req);
r = uv_fs_readdir(loop, &readdir_req, path, 0, file_readdir_cb);
ASSERT(r == 0);