parent
3adf0f3579
commit
7c50874422
@ -31,8 +31,9 @@ UVW_INLINE void fs_event_handle::start(const std::string &path, event_flags flag
|
||||
}
|
||||
|
||||
UVW_INLINE void fs_event_handle::stop() {
|
||||
// uv_fs_event_stop never returns a value other than 0 apparently
|
||||
uv_fs_event_stop(raw());
|
||||
if(auto err = uv_fs_event_stop(raw()); err != 0) {
|
||||
publish(error_event{err});
|
||||
}
|
||||
}
|
||||
|
||||
UVW_INLINE std::string fs_event_handle::path() UVW_NOEXCEPT {
|
||||
|
||||
@ -22,7 +22,7 @@ UVW_INLINE void timer_handle::start(timer_handle::time timeout, timer_handle::ti
|
||||
}
|
||||
|
||||
UVW_INLINE void timer_handle::stop() {
|
||||
// uv_timer_stop never returns a value other than 0 apparently
|
||||
// uv_timer_stop never returns 0 apparently
|
||||
uv_timer_stop(raw());
|
||||
}
|
||||
|
||||
|
||||
@ -9,13 +9,10 @@ TEST(FsEvent, Functionalities) {
|
||||
auto handle = loop->resource<uvw::fs_event_handle>();
|
||||
auto request = loop->resource<uvw::file_req>();
|
||||
|
||||
bool checkErrorEvent = false;
|
||||
bool checkFsEventEvent = false;
|
||||
|
||||
handle->on<uvw::error_event>([&](const auto &, auto &) {
|
||||
ASSERT_FALSE(checkErrorEvent);
|
||||
checkErrorEvent = true;
|
||||
});
|
||||
handle->on<uvw::error_event>([](const auto &, auto &) { FAIL(); });
|
||||
request->on<uvw::error_event>([](const auto &, auto &) { FAIL(); });
|
||||
|
||||
handle->on<uvw::fs_event_event>([&checkFsEventEvent](const auto &event, auto &hndl) {
|
||||
ASSERT_FALSE(checkFsEventEvent);
|
||||
@ -26,8 +23,6 @@ TEST(FsEvent, Functionalities) {
|
||||
ASSERT_TRUE(hndl.closing());
|
||||
});
|
||||
|
||||
request->on<uvw::error_event>([](const auto &, auto &) { FAIL(); });
|
||||
|
||||
request->on<uvw::fs_event>([&](const auto &event, auto &req) {
|
||||
switch(event.type) {
|
||||
case uvw::fs_req::fs_type::WRITE:
|
||||
@ -50,11 +45,6 @@ TEST(FsEvent, Functionalities) {
|
||||
ASSERT_TRUE(handle->active());
|
||||
ASSERT_FALSE(handle->closing());
|
||||
|
||||
handle->start(std::string{TARGET_FS_EVENT_DIR}, uvw::fs_event_handle::event_flags::RECURSIVE);
|
||||
|
||||
ASSERT_TRUE(checkErrorEvent);
|
||||
ASSERT_FALSE(checkFsEventEvent);
|
||||
|
||||
loop->run();
|
||||
|
||||
ASSERT_TRUE(checkFsEventEvent);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user