Skip to content
Closed
Show file tree
Hide file tree
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: 3 additions & 1 deletion cmake/CliFboss2Test.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ gtest_discover_tests(fboss2_framework_test)

# cmd_test - Command tests from BUCK file
add_executable(fboss2_cmd_test
fboss/cli/fboss2/oss/CmdListConfig.cpp
fboss/cli/fboss2/test/TestMain.cpp
fboss/cli/fboss2/test/CmdConfigAppliedInfoTest.cpp
fboss/cli/fboss2/test/CmdConfigHistoryTest.cpp
Expand All @@ -43,6 +44,8 @@ add_executable(fboss2_cmd_test
fboss/cli/fboss2/test/CmdConfigReloadTest.cpp
fboss/cli/fboss2/test/CmdConfigSessionDiffTest.cpp
fboss/cli/fboss2/test/CmdConfigSessionTest.cpp
fboss/cli/fboss2/test/CmdGetPcapTest.cpp
fboss/cli/fboss2/test/CmdListConfigTest.cpp
fboss/cli/fboss2/test/CmdSetPortStateTest.cpp
fboss/cli/fboss2/test/CmdShowAclTest.cpp
fboss/cli/fboss2/test/CmdShowAgentSslTest.cpp
Expand All @@ -54,7 +57,6 @@ add_executable(fboss2_cmd_test
fboss/cli/fboss2/test/CmdShowL2Test.cpp
fboss/cli/fboss2/test/CmdShowLldpTest.cpp
fboss/cli/fboss2/test/CmdShowNdpTest.cpp
fboss/cli/fboss2/test/CmdGetPcapTest.cpp
fboss/cli/fboss2/test/CmdShowAggregatePortTest.cpp
fboss/cli/fboss2/test/CmdShowCpuPortTest.cpp
fboss/cli/fboss2/test/CmdShowExampleTest.cpp
Expand Down
1 change: 1 addition & 0 deletions fboss/cli/fboss2/test/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ cpp_unittest(
"CmdConfigSessionDiffTest.cpp",
"CmdConfigSessionTest.cpp",
"CmdGetPcapTest.cpp",
"CmdListConfigTest.cpp",
"CmdSetPortStateTest.cpp",
"CmdShowAclTest.cpp",
"CmdShowAgentSslTest.cpp",
Expand Down
30 changes: 30 additions & 0 deletions fboss/cli/fboss2/test/CmdListConfigTest.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright (c) 2004-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*/

#include <gtest/gtest.h>

#include "fboss/cli/fboss2/CmdList.h"
#include "fboss/cli/fboss2/CmdSubcommands.h"

namespace facebook::fboss {

// This test verifies that the command trees can be successfully registered
// with CLI11 without throwing CLI::OptionAlreadyAdded exceptions due to
// duplicate subcommand names.
TEST(CmdListConfigTest, noDuplicateSubcommands) {
CLI::App app{"Test CLI"};

// This will throw CLI::OptionAlreadyAdded if there are duplicate subcommands
EXPECT_NO_THROW(
CmdSubcommands().init(
app, kCommandTree(), kAdditionalCommandTree(), kSpecialCommands()));
}

} // namespace facebook::fboss
Loading