TEST(Option, FlagAliasToJoined) { TestOptTable T; unsigned MAI, MAC; // Check that a flag alias provides an empty argument to a joined option. const char *MyArgs[] = { "-K" }; InputArgList AL = T.ParseArgs(MyArgs, MAI, MAC); EXPECT_EQ(AL.size(), 1U); EXPECT_TRUE(AL.hasArg(OPT_B)); EXPECT_EQ(1U, AL.getAllArgValues(OPT_B).size()); EXPECT_EQ("", AL.getAllArgValues(OPT_B)[0]); }
TEST(Option, Slurp) { TestOptTable T; unsigned MAI, MAC; const char *MyArgs[] = { "-A", "-slurp", "-B", "--", "foo" }; InputArgList AL = T.ParseArgs(MyArgs, MAI, MAC); EXPECT_EQ(AL.size(), 2U); EXPECT_TRUE(AL.hasArg(OPT_A)); EXPECT_FALSE(AL.hasArg(OPT_B)); EXPECT_TRUE(AL.hasArg(OPT_Slurp)); EXPECT_EQ(3U, AL.getAllArgValues(OPT_Slurp).size()); EXPECT_EQ("-B", AL.getAllArgValues(OPT_Slurp)[0]); EXPECT_EQ("--", AL.getAllArgValues(OPT_Slurp)[1]); EXPECT_EQ("foo", AL.getAllArgValues(OPT_Slurp)[2]); }