Skip to content

Commit 6d816ad

Browse files
wrowemattklein123
authored andcommitted
Correct test of OptionsImpl argc type (Was: Correct type for std::array size() result) (#9290)
The std::array API uses std::size_t for the size() nelts count. This is a larger sized int than 'int', which causes this code to break on Windows compilation. Use the stdcxx type for conformance and portability. Signed-off-by: Sunjay Bhatia <sbhatia@pivotal.io> Signed-off-by: William A Rowe Jr <wrowe@pivotal.io>
1 parent cbf565f commit 6d816ad

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/server/options_impl_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,15 +253,15 @@ TEST_F(OptionsImplTest, OptionsAreInSyncWithProto) {
253253
TEST_F(OptionsImplTest, OptionsFromArgv) {
254254
const std::array<const char*, 3> args{"envoy", "-c", "hello"};
255255
std::unique_ptr<OptionsImpl> options = std::make_unique<OptionsImpl>(
256-
args.size(), args.data(), [](bool) { return "1"; }, spdlog::level::warn);
256+
static_cast<int>(args.size()), args.data(), [](bool) { return "1"; }, spdlog::level::warn);
257257
// Spot check that the arguments were parsed.
258258
EXPECT_EQ("hello", options->configPath());
259259
}
260260

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

0 commit comments

Comments
 (0)