Skip to content

Commit

Permalink
fix core tests (#4138)
Browse files Browse the repository at this point in the history
  • Loading branch information
matyhtf authored Apr 8, 2021
1 parent 4c85b2b commit 7330c1a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions core-tests/src/coroutine/hook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,18 +215,23 @@ TEST(coroutine_hook, flock) {
}

TEST(coroutine_hook, read_dir) {
auto fn = []() {
auto fp = opendir("/tmp");
std::string dir1(readdir(fp)->d_name);
std::string dir2(readdir(fp)->d_name);
closedir(fp);

auto fn = [&]() {
auto fp = swoole_coroutine_opendir("/tmp");
ASSERT_NE(fp, nullptr);
struct dirent *entry;

entry = swoole_coroutine_readdir(fp);
ASSERT_NE(entry, nullptr);
ASSERT_STREQ(entry->d_name, ".");
ASSERT_STREQ(entry->d_name, dir1.c_str());

entry = swoole_coroutine_readdir(fp);
ASSERT_NE(entry, nullptr);
ASSERT_STREQ(entry->d_name, "..");
ASSERT_STREQ(entry->d_name, dir2.c_str());

swoole_coroutine_closedir(fp);
};
Expand Down

0 comments on commit 7330c1a

Please sign in to comment.