From 3fe8cb7fedd394599eafae877aa85d3a14ec2a74 Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Tue, 8 Nov 2016 16:53:36 +0100 Subject: [PATCH] tests: fs/FileReq/Mkdtemp and fs/FileReq/MkdtempSync --- test/uvw/fs.cpp | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/test/uvw/fs.cpp b/test/uvw/fs.cpp index 259de090..5de92356 100644 --- a/test/uvw/fs.cpp +++ b/test/uvw/fs.cpp @@ -545,17 +545,44 @@ TEST(FsReq, MkdirAndRmdirSync) { } -/* TEST(FsReq, Mkdtemp) { - // TODO + const std::string dirname = std::string{TARGET_FS_DIR} + std::string{"/test.dir.XXXXXX"}; + + auto loop = uvw::Loop::getDefault(); + auto request = loop->resource(); + + bool checkFsMkdtempEvent = false; + + request->on([](const auto &, auto &) { + FAIL(); + }); + + request->on>([&checkFsMkdtempEvent](const auto &, auto &) { + ASSERT_FALSE(checkFsMkdtempEvent); + checkFsMkdtempEvent = true; + }); + + request->mkdtemp(dirname); + + loop->run(); + + ASSERT_TRUE(checkFsMkdtempEvent); } TEST(FsReq, MkdtempSync) { - // TODO + const std::string dirname = std::string{TARGET_FS_DIR} + std::string{"/test.dir.XXXXXX"}; + + auto loop = uvw::Loop::getDefault(); + auto request = loop->resource(); + + ASSERT_TRUE(request->mkdtempSync(dirname)); + + loop->run(); } +/* TEST(FsReq, Scandir) { // TODO }