-Wshadow should not give errors anymore
This commit is contained in:
parent
0a8558ecdd
commit
e60b68f05f
@ -12,7 +12,7 @@ void listen(uvw::Loop &loop) {
|
|||||||
std::cout << "error " << std::endl;
|
std::cout << "error " << std::endl;
|
||||||
});
|
});
|
||||||
|
|
||||||
tcp->once<uvw::ListenEvent>([](const uvw::ListenEvent &event, uvw::TcpHandle &srv) mutable {
|
tcp->once<uvw::ListenEvent>([](const uvw::ListenEvent &, uvw::TcpHandle &srv) mutable {
|
||||||
std::cout << "listen" << std::endl;
|
std::cout << "listen" << std::endl;
|
||||||
|
|
||||||
std::shared_ptr<uvw::TcpHandle> client = srv.loop().resource<uvw::TcpHandle>();
|
std::shared_ptr<uvw::TcpHandle> client = srv.loop().resource<uvw::TcpHandle>();
|
||||||
@ -23,9 +23,7 @@ void listen(uvw::Loop &loop) {
|
|||||||
|
|
||||||
client->on<uvw::CloseEvent>([ptr = srv.shared_from_this()](const uvw::CloseEvent &, uvw::TcpHandle &) mutable {
|
client->on<uvw::CloseEvent>([ptr = srv.shared_from_this()](const uvw::CloseEvent &, uvw::TcpHandle &) mutable {
|
||||||
std::cout << "close" << std::endl;
|
std::cout << "close" << std::endl;
|
||||||
|
ptr->close();
|
||||||
uvw::TcpHandle &srv = *ptr;
|
|
||||||
srv.close();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
srv.accept(*client);
|
srv.accept(*client);
|
||||||
@ -41,12 +39,12 @@ void listen(uvw::Loop &loop) {
|
|||||||
std::cout << "data length: " << event.length << std::endl;
|
std::cout << "data length: " << event.length << std::endl;
|
||||||
});
|
});
|
||||||
|
|
||||||
client->on<uvw::EndEvent>([](const uvw::EndEvent &, uvw::TcpHandle &client) {
|
client->on<uvw::EndEvent>([](const uvw::EndEvent &, uvw::TcpHandle &handle) {
|
||||||
std::cout << "end" << std::endl;
|
std::cout << "end" << std::endl;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
client.loop().walk([&count](uvw::BaseHandle &handle) { ++count; });
|
handle.loop().walk([&count](uvw::BaseHandle &) { ++count; });
|
||||||
std::cout << "still alive: " << count << " handles" << std::endl;
|
std::cout << "still alive: " << count << " handles" << std::endl;
|
||||||
client.close();
|
handle.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
client->read();
|
client->read();
|
||||||
@ -68,20 +66,20 @@ void conn(uvw::Loop &loop) {
|
|||||||
std::cout << "error " << std::endl;
|
std::cout << "error " << std::endl;
|
||||||
});
|
});
|
||||||
|
|
||||||
tcp->once<uvw::WriteEvent>([](const uvw::WriteEvent &, uvw::TcpHandle &tcp) mutable {
|
tcp->once<uvw::WriteEvent>([](const uvw::WriteEvent &, uvw::TcpHandle &handle) mutable {
|
||||||
std::cout << "write" << std::endl;
|
std::cout << "write" << std::endl;
|
||||||
tcp.close();
|
handle.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
tcp->once<uvw::ConnectEvent>([](const uvw::ConnectEvent &, uvw::TcpHandle &tcp) mutable {
|
tcp->once<uvw::ConnectEvent>([](const uvw::ConnectEvent &, uvw::TcpHandle &handle) mutable {
|
||||||
std::cout << "connect" << std::endl;
|
std::cout << "connect" << std::endl;
|
||||||
|
|
||||||
auto dataTryWrite = std::unique_ptr<char[]>(new char[1]{ 'a' });
|
auto dataTryWrite = std::unique_ptr<char[]>(new char[1]{ 'a' });
|
||||||
int bw = tcp.tryWrite(std::move(dataTryWrite), 1);
|
int bw = handle.tryWrite(std::move(dataTryWrite), 1);
|
||||||
std::cout << "written: " << ((int)bw) << std::endl;
|
std::cout << "written: " << ((int)bw) << std::endl;
|
||||||
|
|
||||||
auto dataWrite = std::unique_ptr<char[]>(new char[2]{ 'b', 'c' });
|
auto dataWrite = std::unique_ptr<char[]>(new char[2]{ 'b', 'c' });
|
||||||
tcp.write(std::move(dataWrite), 2);
|
handle.write(std::move(dataWrite), 2);
|
||||||
});
|
});
|
||||||
|
|
||||||
tcp->once<uvw::CloseEvent>([](const uvw::CloseEvent &, uvw::TcpHandle &) mutable {
|
tcp->once<uvw::CloseEvent>([](const uvw::CloseEvent &, uvw::TcpHandle &) mutable {
|
||||||
|
|||||||
@ -14,11 +14,11 @@ TEST(Async, Send) {
|
|||||||
checkErrorEvent = true;
|
checkErrorEvent = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
handle->on<uvw::AsyncEvent>([&checkAsyncEvent](const auto &, auto &handle) {
|
handle->on<uvw::AsyncEvent>([&checkAsyncEvent](const auto &, auto &hndl) {
|
||||||
ASSERT_FALSE(checkAsyncEvent);
|
ASSERT_FALSE(checkAsyncEvent);
|
||||||
checkAsyncEvent = true;
|
checkAsyncEvent = true;
|
||||||
handle.close();
|
hndl.close();
|
||||||
ASSERT_TRUE(handle.closing());
|
ASSERT_TRUE(hndl.closing());
|
||||||
});
|
});
|
||||||
|
|
||||||
handle->send();
|
handle->send();
|
||||||
|
|||||||
@ -14,12 +14,12 @@ TEST(Check, StartAndStop) {
|
|||||||
checkErrorEvent = true;
|
checkErrorEvent = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
handle->on<uvw::CheckEvent>([&checkCheckEvent](const auto &, auto &handle) {
|
handle->on<uvw::CheckEvent>([&checkCheckEvent](const auto &, auto &hndl) {
|
||||||
ASSERT_FALSE(checkCheckEvent);
|
ASSERT_FALSE(checkCheckEvent);
|
||||||
checkCheckEvent = true;
|
checkCheckEvent = true;
|
||||||
handle.stop();
|
hndl.stop();
|
||||||
handle.close();
|
hndl.close();
|
||||||
ASSERT_TRUE(handle.closing());
|
ASSERT_TRUE(hndl.closing());
|
||||||
});
|
});
|
||||||
|
|
||||||
handle->start();
|
handle->start();
|
||||||
|
|||||||
@ -21,15 +21,15 @@ TEST(FileReq, OpenAndClose) {
|
|||||||
FAIL();
|
FAIL();
|
||||||
});
|
});
|
||||||
|
|
||||||
request->on<uvw::FsEvent<uvw::FileReq::Type::CLOSE>>([&checkFileCloseEvent](const auto &, auto &request) {
|
request->on<uvw::FsEvent<uvw::FileReq::Type::CLOSE>>([&checkFileCloseEvent](const auto &, auto &) {
|
||||||
ASSERT_FALSE(checkFileCloseEvent);
|
ASSERT_FALSE(checkFileCloseEvent);
|
||||||
checkFileCloseEvent = true;
|
checkFileCloseEvent = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
request->on<uvw::FsEvent<uvw::FileReq::Type::OPEN>>([&checkFileOpenEvent](const auto &, auto &request) {
|
request->on<uvw::FsEvent<uvw::FileReq::Type::OPEN>>([&checkFileOpenEvent](const auto &, auto &req) {
|
||||||
ASSERT_FALSE(checkFileOpenEvent);
|
ASSERT_FALSE(checkFileOpenEvent);
|
||||||
checkFileOpenEvent = true;
|
checkFileOpenEvent = true;
|
||||||
request.close();
|
req.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
request->open(filename, O_CREAT | O_WRONLY, 0644);
|
request->open(filename, O_CREAT | O_WRONLY, 0644);
|
||||||
@ -67,21 +67,21 @@ TEST(FileReq, RWChecked) {
|
|||||||
FAIL();
|
FAIL();
|
||||||
});
|
});
|
||||||
|
|
||||||
request->on<uvw::FsEvent<uvw::FileReq::Type::READ>>([&checkFileReadEvent](const auto &event, auto &request) {
|
request->on<uvw::FsEvent<uvw::FileReq::Type::READ>>([&checkFileReadEvent](const auto &event, auto &req) {
|
||||||
ASSERT_FALSE(checkFileReadEvent);
|
ASSERT_FALSE(checkFileReadEvent);
|
||||||
ASSERT_EQ(event.data[0], 42);
|
ASSERT_EQ(event.data[0], 42);
|
||||||
checkFileReadEvent = true;
|
checkFileReadEvent = true;
|
||||||
request.close();
|
req.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
request->on<uvw::FsEvent<uvw::FileReq::Type::WRITE>>([&checkFileWriteEvent](const auto &, auto &request) {
|
request->on<uvw::FsEvent<uvw::FileReq::Type::WRITE>>([&checkFileWriteEvent](const auto &, auto &req) {
|
||||||
ASSERT_FALSE(checkFileWriteEvent);
|
ASSERT_FALSE(checkFileWriteEvent);
|
||||||
checkFileWriteEvent = true;
|
checkFileWriteEvent = true;
|
||||||
request.read(0, 1);
|
req.read(0, 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
request->on<uvw::FsEvent<uvw::FileReq::Type::OPEN>>([](const auto &, auto &request) {
|
request->on<uvw::FsEvent<uvw::FileReq::Type::OPEN>>([](const auto &, auto &req) {
|
||||||
request.write(std::unique_ptr<char[]>{new char[1]{ 42 }}, 1, 0);
|
req.write(std::unique_ptr<char[]>{new char[1]{ 42 }}, 1, 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
request->open(filename, O_CREAT | O_RDWR | O_TRUNC, 0644);
|
request->open(filename, O_CREAT | O_RDWR | O_TRUNC, 0644);
|
||||||
@ -107,21 +107,21 @@ TEST(FileReq, RWUnchecked) {
|
|||||||
FAIL();
|
FAIL();
|
||||||
});
|
});
|
||||||
|
|
||||||
request->on<uvw::FsEvent<uvw::FileReq::Type::READ>>([&checkFileReadEvent](const auto &event, auto &request) {
|
request->on<uvw::FsEvent<uvw::FileReq::Type::READ>>([&checkFileReadEvent](const auto &event, auto &req) {
|
||||||
ASSERT_FALSE(checkFileReadEvent);
|
ASSERT_FALSE(checkFileReadEvent);
|
||||||
ASSERT_EQ(event.data[0], 42);
|
ASSERT_EQ(event.data[0], 42);
|
||||||
checkFileReadEvent = true;
|
checkFileReadEvent = true;
|
||||||
request.close();
|
req.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
request->on<uvw::FsEvent<uvw::FileReq::Type::WRITE>>([&checkFileWriteEvent](const auto &, auto &request) {
|
request->on<uvw::FsEvent<uvw::FileReq::Type::WRITE>>([&checkFileWriteEvent](const auto &, auto &req) {
|
||||||
ASSERT_FALSE(checkFileWriteEvent);
|
ASSERT_FALSE(checkFileWriteEvent);
|
||||||
checkFileWriteEvent = true;
|
checkFileWriteEvent = true;
|
||||||
request.read(0, 1);
|
req.read(0, 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
request->on<uvw::FsEvent<uvw::FileReq::Type::OPEN>>([&data](const auto &, auto &request) {
|
request->on<uvw::FsEvent<uvw::FileReq::Type::OPEN>>([&data](const auto &, auto &req) {
|
||||||
request.write(data.get(), 1, 0);
|
req.write(data.get(), 1, 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
request->open(filename, O_CREAT | O_RDWR | O_TRUNC, 0644);
|
request->open(filename, O_CREAT | O_RDWR | O_TRUNC, 0644);
|
||||||
@ -170,14 +170,14 @@ TEST(FileReq, Stat) {
|
|||||||
FAIL();
|
FAIL();
|
||||||
});
|
});
|
||||||
|
|
||||||
request->on<uvw::FsEvent<uvw::FileReq::Type::FSTAT>>([&checkFileStatEvent](const auto &, auto &request) {
|
request->on<uvw::FsEvent<uvw::FileReq::Type::FSTAT>>([&checkFileStatEvent](const auto &, auto &req) {
|
||||||
ASSERT_FALSE(checkFileStatEvent);
|
ASSERT_FALSE(checkFileStatEvent);
|
||||||
checkFileStatEvent = true;
|
checkFileStatEvent = true;
|
||||||
request.close();
|
req.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
request->on<uvw::FsEvent<uvw::FileReq::Type::OPEN>>([](const auto &, auto &request) {
|
request->on<uvw::FsEvent<uvw::FileReq::Type::OPEN>>([](const auto &, auto &req) {
|
||||||
request.stat();
|
req.stat();
|
||||||
});
|
});
|
||||||
|
|
||||||
request->open(filename, O_CREAT | O_RDWR | O_TRUNC, 0644);
|
request->open(filename, O_CREAT | O_RDWR | O_TRUNC, 0644);
|
||||||
@ -218,14 +218,14 @@ TEST(FileReq, Sync) {
|
|||||||
FAIL();
|
FAIL();
|
||||||
});
|
});
|
||||||
|
|
||||||
request->on<uvw::FsEvent<uvw::FileReq::Type::FSYNC>>([&checkFileSyncEvent](const auto &, auto &request) {
|
request->on<uvw::FsEvent<uvw::FileReq::Type::FSYNC>>([&checkFileSyncEvent](const auto &, auto &req) {
|
||||||
ASSERT_FALSE(checkFileSyncEvent);
|
ASSERT_FALSE(checkFileSyncEvent);
|
||||||
checkFileSyncEvent = true;
|
checkFileSyncEvent = true;
|
||||||
request.close();
|
req.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
request->on<uvw::FsEvent<uvw::FileReq::Type::OPEN>>([](const auto &, auto &request) {
|
request->on<uvw::FsEvent<uvw::FileReq::Type::OPEN>>([](const auto &, auto &req) {
|
||||||
request.sync();
|
req.sync();
|
||||||
});
|
});
|
||||||
|
|
||||||
request->open(filename, O_CREAT | O_RDWR | O_TRUNC, 0644);
|
request->open(filename, O_CREAT | O_RDWR | O_TRUNC, 0644);
|
||||||
@ -262,14 +262,14 @@ TEST(FileReq, Datasync) {
|
|||||||
FAIL();
|
FAIL();
|
||||||
});
|
});
|
||||||
|
|
||||||
request->on<uvw::FsEvent<uvw::FileReq::Type::FDATASYNC>>([&checkFileDatasyncEvent](const auto &, auto &request) {
|
request->on<uvw::FsEvent<uvw::FileReq::Type::FDATASYNC>>([&checkFileDatasyncEvent](const auto &, auto &req) {
|
||||||
ASSERT_FALSE(checkFileDatasyncEvent);
|
ASSERT_FALSE(checkFileDatasyncEvent);
|
||||||
checkFileDatasyncEvent = true;
|
checkFileDatasyncEvent = true;
|
||||||
request.close();
|
req.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
request->on<uvw::FsEvent<uvw::FileReq::Type::OPEN>>([](const auto &, auto &request) {
|
request->on<uvw::FsEvent<uvw::FileReq::Type::OPEN>>([](const auto &, auto &req) {
|
||||||
request.datasync();
|
req.datasync();
|
||||||
});
|
});
|
||||||
|
|
||||||
request->open(filename, O_CREAT | O_RDWR | O_TRUNC, 0644);
|
request->open(filename, O_CREAT | O_RDWR | O_TRUNC, 0644);
|
||||||
@ -306,14 +306,14 @@ TEST(FileReq, Truncate) {
|
|||||||
FAIL();
|
FAIL();
|
||||||
});
|
});
|
||||||
|
|
||||||
request->on<uvw::FsEvent<uvw::FileReq::Type::FTRUNCATE>>([&checkFileTruncateEvent](const auto &, auto &request) {
|
request->on<uvw::FsEvent<uvw::FileReq::Type::FTRUNCATE>>([&checkFileTruncateEvent](const auto &, auto &req) {
|
||||||
ASSERT_FALSE(checkFileTruncateEvent);
|
ASSERT_FALSE(checkFileTruncateEvent);
|
||||||
checkFileTruncateEvent = true;
|
checkFileTruncateEvent = true;
|
||||||
request.close();
|
req.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
request->on<uvw::FsEvent<uvw::FileReq::Type::OPEN>>([](const auto &, auto &request) {
|
request->on<uvw::FsEvent<uvw::FileReq::Type::OPEN>>([](const auto &, auto &req) {
|
||||||
request.truncate(0);
|
req.truncate(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
request->open(filename, O_CREAT | O_RDWR | O_TRUNC, 0644);
|
request->open(filename, O_CREAT | O_RDWR | O_TRUNC, 0644);
|
||||||
@ -362,14 +362,14 @@ TEST(FileReq, Chmod) {
|
|||||||
FAIL();
|
FAIL();
|
||||||
});
|
});
|
||||||
|
|
||||||
request->on<uvw::FsEvent<uvw::FileReq::Type::FCHMOD>>([&checkFileChmodEvent](const auto &, auto &request) {
|
request->on<uvw::FsEvent<uvw::FileReq::Type::FCHMOD>>([&checkFileChmodEvent](const auto &, auto &req) {
|
||||||
ASSERT_FALSE(checkFileChmodEvent);
|
ASSERT_FALSE(checkFileChmodEvent);
|
||||||
checkFileChmodEvent = true;
|
checkFileChmodEvent = true;
|
||||||
request.close();
|
req.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
request->on<uvw::FsEvent<uvw::FileReq::Type::OPEN>>([](const auto &, auto &request) {
|
request->on<uvw::FsEvent<uvw::FileReq::Type::OPEN>>([](const auto &, auto &req) {
|
||||||
request.chmod(0644);
|
req.chmod(0644);
|
||||||
});
|
});
|
||||||
|
|
||||||
request->open(filename, O_CREAT | O_RDWR | O_TRUNC, 0644);
|
request->open(filename, O_CREAT | O_RDWR | O_TRUNC, 0644);
|
||||||
@ -406,17 +406,17 @@ TEST(FileReq, Utime) {
|
|||||||
FAIL();
|
FAIL();
|
||||||
});
|
});
|
||||||
|
|
||||||
request->on<uvw::FsEvent<uvw::FileReq::Type::FUTIME>>([&checkFileUtimeEvent](const auto &, auto &request) {
|
request->on<uvw::FsEvent<uvw::FileReq::Type::FUTIME>>([&checkFileUtimeEvent](const auto &, auto &req) {
|
||||||
ASSERT_FALSE(checkFileUtimeEvent);
|
ASSERT_FALSE(checkFileUtimeEvent);
|
||||||
checkFileUtimeEvent = true;
|
checkFileUtimeEvent = true;
|
||||||
request.close();
|
req.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
request->on<uvw::FsEvent<uvw::FileReq::Type::OPEN>>([](const auto &, auto &request) {
|
request->on<uvw::FsEvent<uvw::FileReq::Type::OPEN>>([](const auto &, auto &req) {
|
||||||
auto now = std::chrono::system_clock::now();
|
auto now = std::chrono::system_clock::now();
|
||||||
auto epoch = now.time_since_epoch();
|
auto epoch = now.time_since_epoch();
|
||||||
auto value = std::chrono::duration_cast<std::chrono::seconds>(epoch);
|
auto value = std::chrono::duration_cast<std::chrono::seconds>(epoch);
|
||||||
request.utime(value, value);
|
req.utime(value, value);
|
||||||
});
|
});
|
||||||
|
|
||||||
request->open(filename, O_CREAT | O_RDWR | O_TRUNC, 0644);
|
request->open(filename, O_CREAT | O_RDWR | O_TRUNC, 0644);
|
||||||
@ -459,18 +459,18 @@ TEST(FileReq, Chown) {
|
|||||||
FAIL();
|
FAIL();
|
||||||
});
|
});
|
||||||
|
|
||||||
request->on<uvw::FsEvent<uvw::FileReq::Type::FCHOWN>>([&checkFileChownEvent](const auto &, auto &request) {
|
request->on<uvw::FsEvent<uvw::FileReq::Type::FCHOWN>>([&checkFileChownEvent](const auto &, auto &req) {
|
||||||
ASSERT_FALSE(checkFileChownEvent);
|
ASSERT_FALSE(checkFileChownEvent);
|
||||||
checkFileChownEvent = true;
|
checkFileChownEvent = true;
|
||||||
request.close();
|
req.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
request->on<uvw::FsEvent<uvw::FileReq::Type::FSTAT>>([](const auto &event, auto &request) {
|
request->on<uvw::FsEvent<uvw::FileReq::Type::FSTAT>>([](const auto &event, auto &req) {
|
||||||
request.chown(event.stat.st_uid, event.stat.st_gid);
|
req.chown(event.stat.st_uid, event.stat.st_gid);
|
||||||
});
|
});
|
||||||
|
|
||||||
request->on<uvw::FsEvent<uvw::FileReq::Type::OPEN>>([](const auto &, auto &request) {
|
request->on<uvw::FsEvent<uvw::FileReq::Type::OPEN>>([](const auto &, auto &req) {
|
||||||
request.stat();
|
req.stat();
|
||||||
});
|
});
|
||||||
|
|
||||||
request->open(filename, O_CREAT | O_RDWR | O_TRUNC, 0644);
|
request->open(filename, O_CREAT | O_RDWR | O_TRUNC, 0644);
|
||||||
|
|||||||
@ -26,10 +26,10 @@ TEST(FsReq, MkdirAndRmdir) {
|
|||||||
checkFsRmdirEvent = true;
|
checkFsRmdirEvent = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
request->on<uvw::FsEvent<uvw::FsReq::Type::MKDIR>>([&checkFsMkdirEvent, &dirname](const auto &, auto &request) {
|
request->on<uvw::FsEvent<uvw::FsReq::Type::MKDIR>>([&checkFsMkdirEvent, &dirname](const auto &, auto &req) {
|
||||||
ASSERT_FALSE(checkFsMkdirEvent);
|
ASSERT_FALSE(checkFsMkdirEvent);
|
||||||
checkFsMkdirEvent = true;
|
checkFsMkdirEvent = true;
|
||||||
request.rmdir(dirname);
|
req.rmdir(dirname);
|
||||||
});
|
});
|
||||||
|
|
||||||
request->mkdir(dirname, 0755);
|
request->mkdir(dirname, 0755);
|
||||||
@ -72,11 +72,11 @@ TEST(FsReq, MkdtempAndRmdir) {
|
|||||||
checkFsRmdirEvent = true;
|
checkFsRmdirEvent = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
request->on<uvw::FsEvent<uvw::FsReq::Type::MKDTEMP>>([&checkFsMkdtempEvent](const auto &event, auto &request) {
|
request->on<uvw::FsEvent<uvw::FsReq::Type::MKDTEMP>>([&checkFsMkdtempEvent](const auto &event, auto &req) {
|
||||||
ASSERT_FALSE(checkFsMkdtempEvent);
|
ASSERT_FALSE(checkFsMkdtempEvent);
|
||||||
ASSERT_NE(event.path, nullptr);
|
ASSERT_NE(event.path, nullptr);
|
||||||
checkFsMkdtempEvent = true;
|
checkFsMkdtempEvent = true;
|
||||||
request.rmdir(event.path);
|
req.rmdir(event.path);
|
||||||
});
|
});
|
||||||
|
|
||||||
request->mkdtemp(dirname);
|
request->mkdtemp(dirname);
|
||||||
|
|||||||
@ -14,12 +14,12 @@ TEST(Idle, StartAndStop) {
|
|||||||
checkErrorEvent = true;
|
checkErrorEvent = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
handle->on<uvw::IdleEvent>([&checkIdleEvent](const auto &, auto &handle) {
|
handle->on<uvw::IdleEvent>([&checkIdleEvent](const auto &, auto &hndl) {
|
||||||
ASSERT_FALSE(checkIdleEvent);
|
ASSERT_FALSE(checkIdleEvent);
|
||||||
checkIdleEvent = true;
|
checkIdleEvent = true;
|
||||||
handle.stop();
|
hndl.stop();
|
||||||
handle.close();
|
hndl.close();
|
||||||
ASSERT_TRUE(handle.closing());
|
ASSERT_TRUE(hndl.closing());
|
||||||
});
|
});
|
||||||
|
|
||||||
handle->start();
|
handle->start();
|
||||||
|
|||||||
@ -34,14 +34,14 @@ TEST(Loop, PartiallyDone) {
|
|||||||
ASSERT_FALSE(loop->alive());
|
ASSERT_FALSE(loop->alive());
|
||||||
|
|
||||||
handle->start();
|
handle->start();
|
||||||
handle->on<uvw::PrepareEvent>([](const auto &, auto &handle) {
|
handle->on<uvw::PrepareEvent>([](const auto &, auto &hndl) {
|
||||||
handle.loop().walk([](uvw::BaseHandle &) {
|
hndl.loop().walk([](uvw::BaseHandle &) {
|
||||||
static bool trigger = true;
|
static bool trigger = true;
|
||||||
ASSERT_TRUE(trigger);
|
ASSERT_TRUE(trigger);
|
||||||
trigger = false;
|
trigger = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
handle.close();
|
hndl.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
ASSERT_TRUE(loop->alive());
|
ASSERT_TRUE(loop->alive());
|
||||||
|
|||||||
@ -14,12 +14,12 @@ TEST(Prepare, StartAndStop) {
|
|||||||
checkErrorEvent = true;
|
checkErrorEvent = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
handle->on<uvw::PrepareEvent>([&checkPrepareEvent](const auto &, auto &handle) {
|
handle->on<uvw::PrepareEvent>([&checkPrepareEvent](const auto &, auto &hndl) {
|
||||||
ASSERT_FALSE(checkPrepareEvent);
|
ASSERT_FALSE(checkPrepareEvent);
|
||||||
checkPrepareEvent = true;
|
checkPrepareEvent = true;
|
||||||
handle.stop();
|
hndl.stop();
|
||||||
handle.close();
|
hndl.close();
|
||||||
ASSERT_TRUE(handle.closing());
|
ASSERT_TRUE(hndl.closing());
|
||||||
});
|
});
|
||||||
|
|
||||||
handle->start();
|
handle->start();
|
||||||
|
|||||||
@ -69,19 +69,19 @@ TEST(Timer, Again) {
|
|||||||
checkErrorEvent = true;
|
checkErrorEvent = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
handle->on<uvw::TimerEvent>([&checkTimerEvent](const auto &, auto &handle) {
|
handle->on<uvw::TimerEvent>([&checkTimerEvent](const auto &, auto &hndl) {
|
||||||
static bool guard = false;
|
static bool guard = false;
|
||||||
|
|
||||||
if(guard) {
|
if(guard) {
|
||||||
handle.stop();
|
hndl.stop();
|
||||||
handle.close();
|
hndl.close();
|
||||||
checkTimerEvent = true;
|
checkTimerEvent = true;
|
||||||
ASSERT_TRUE(handle.closing());
|
ASSERT_TRUE(hndl.closing());
|
||||||
} else {
|
} else {
|
||||||
guard = true;
|
guard = true;
|
||||||
handle.again();
|
hndl.again();
|
||||||
ASSERT_EQ(handle.repeat(), uvw::TimerHandle::Time{1});
|
ASSERT_EQ(hndl.repeat(), uvw::TimerHandle::Time{1});
|
||||||
ASSERT_FALSE(handle.closing());
|
ASSERT_FALSE(hndl.closing());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user