Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct test of OptionsImpl argc type (Was: Correct type for std::array size() result) #9290

Merged
merged 3 commits into from
Dec 17, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions test/server/options_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -252,15 +252,15 @@ TEST_F(OptionsImplTest, OptionsAreInSyncWithProto) {
TEST_F(OptionsImplTest, OptionsFromArgv) {
const std::array<const char*, 3> args{"envoy", "-c", "hello"};
std::unique_ptr<OptionsImpl> options = std::make_unique<OptionsImpl>(
args.size(), args.data(), [](bool) { return "1"; }, spdlog::level::warn);
static_cast<int>(args.size()), args.data(), [](bool) { return "1"; }, spdlog::level::warn);
wrowe marked this conversation as resolved.
Show resolved Hide resolved
// Spot check that the arguments were parsed.
EXPECT_EQ("hello", options->configPath());
}

TEST_F(OptionsImplTest, OptionsFromArgvPrefix) {
const std::array<const char*, 5> args{"envoy", "-c", "hello", "--admin-address-path", "goodbye"};
std::unique_ptr<OptionsImpl> options = std::make_unique<OptionsImpl>(
args.size() - 2, // Pass in only a prefix of the args
static_cast<int>(args.size()) - 2, // Pass in only a prefix of the args
args.data(), [](bool) { return "1"; }, spdlog::level::warn);
EXPECT_EQ("hello", options->configPath());
// This should still have the default value since the extra arguments are
Expand Down