TEST_F(TargetParserIfaceTest, DispatchEmpty) { OptionsParser main_parser; Argv argv; argv.push_back("name") .push_back(json_path.string()); main_parser.parse(argv.size(), argv.get(), &dummy_parser); ASSERT_EQ(0u, dummy_parser.input.size()); }
TEST_F(TargetParserIfaceTest, NoDispatch) { OptionsParser main_parser; Argv argv; argv.push_back("name") .push_back(json_path.string()); main_parser.parse(argv.size(), argv.get(), nullptr); SUCCEED(); }
TEST_F(TargetParserIfaceTest, DispatchPositional) { OptionsParser main_parser; Argv argv; argv.push_back("name") .push_back(json_path.string()) .push_back("--") .push_back("unknown"); main_parser.parse(argv.size(), argv.get(), &dummy_parser); ASSERT_EQ(1u, dummy_parser.input.size()); ASSERT_EQ("unknown", dummy_parser.input.at(0)); }
TEST_F(TargetParserIfaceTest, DispatchMany) { OptionsParser main_parser; Argv argv; argv.push_back("name") .push_back(json_path.string()) .push_back("--"); size_t iters = 16; for (size_t i = 0; i < iters; i++) { argv.push_back("--unknown" + std::to_string(i)) .push_back(std::to_string(i)); } main_parser.parse(argv.size(), argv.get(), &dummy_parser); ASSERT_EQ(2 * iters, dummy_parser.input.size()); }