mirror of
https://github.com/falk-werner/webfuse
synced 2024-10-27 20:34:10 +00:00
chore: added unit tests for mount options
This commit is contained in:
parent
52c69dfb4d
commit
db10f944be
@ -1,6 +1,7 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include <gmock/gmock.h>
|
||||
#include "webfuse/mountpoint.h"
|
||||
#include "webfuse/impl/mountpoint.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
@ -45,3 +46,48 @@ TEST(mountpoint, ondispose)
|
||||
|
||||
wf_mountpoint_dispose(mountpoint);
|
||||
}
|
||||
|
||||
TEST(mountpoint, default_options)
|
||||
{
|
||||
wf_mountpoint * mountpoint = wf_mountpoint_create("/some/path");
|
||||
ASSERT_EQ(1, mountpoint->options.size);
|
||||
ASSERT_STREQ("", mountpoint->options.items[0]);
|
||||
ASSERT_EQ(nullptr, mountpoint->options.items[1]);
|
||||
|
||||
wf_mountpoint_dispose(mountpoint);
|
||||
}
|
||||
|
||||
TEST(mountpoint, add_mountoption)
|
||||
{
|
||||
wf_mountpoint * mountpoint = wf_mountpoint_create("/some/path");
|
||||
wf_mountpoint_add_mountoption(mountpoint, "-o");
|
||||
wf_mountpoint_add_mountoption(mountpoint, "allow_other");
|
||||
|
||||
ASSERT_EQ(3, mountpoint->options.size);
|
||||
ASSERT_STREQ("", mountpoint->options.items[0]);
|
||||
ASSERT_STREQ("-o", mountpoint->options.items[1]);
|
||||
ASSERT_STREQ("allow_other", mountpoint->options.items[2]);
|
||||
ASSERT_EQ(nullptr, mountpoint->options.items[3]);
|
||||
|
||||
wf_mountpoint_dispose(mountpoint);
|
||||
}
|
||||
|
||||
TEST(mountpoint, add_many_mountoption)
|
||||
{
|
||||
wf_mountpoint * mountpoint = wf_mountpoint_create("/some/path");
|
||||
constexpr size_t count = 256;
|
||||
for (size_t i = 0; i < count; i++)
|
||||
{
|
||||
wf_mountpoint_add_mountoption(mountpoint, "any option");
|
||||
}
|
||||
|
||||
ASSERT_EQ(count + 1, mountpoint->options.size);
|
||||
ASSERT_STREQ("", mountpoint->options.items[0]);
|
||||
for (size_t i = 0; i < count; i++)
|
||||
{
|
||||
ASSERT_STREQ("any option", mountpoint->options.items[i + 1]);
|
||||
}
|
||||
ASSERT_EQ(nullptr, mountpoint->options.items[count + 1]);
|
||||
|
||||
wf_mountpoint_dispose(mountpoint);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user