public void TestFlagAliasToJoined() { OptionTable T = new OptionTable(InfoTable); // Check that a flag alias provides an empty argument to a joined option. string[] MyArgs = new string[] { "-K" }; InputArgumentList AL = T.ParseArgs(MyArgs, out int MAI, out int MAC); Assert.IsTrue(AL.Size() == 1U); Assert.IsTrue(AL.HasArg(OPT_ID.OPT_B)); var allArgs = AL.GetAllArgValues(OPT_ID.OPT_B); Assert.IsTrue(1U == allArgs.Count); Assert.IsTrue("" == AL.GetAllArgValues(OPT_ID.OPT_B)[0]); }
public void TestSlurp() { OptionTable T = new OptionTable(InfoTable); string[] MyArgs = new string[] { "-A", "-slurp", "-B", "--", "foo" }; InputArgumentList AL = T.ParseArgs(MyArgs, out int MAI, out int MAC); Assert.IsTrue(AL.Size() == 2U); Assert.IsTrue(AL.HasArg(OPT_ID.OPT_A)); Assert.IsTrue(!AL.HasArg(OPT_ID.OPT_B)); Assert.IsTrue(AL.HasArg(OPT_ID.OPT_Slurp)); Assert.IsTrue(3U == AL.GetAllArgValues(OPT_ID.OPT_Slurp).Count); Assert.IsTrue("-B" == AL.GetAllArgValues(OPT_ID.OPT_Slurp)[0]); Assert.IsTrue("--" == AL.GetAllArgValues(OPT_ID.OPT_Slurp)[1]); Assert.IsTrue("foo" == AL.GetAllArgValues(OPT_ID.OPT_Slurp)[2]); }