import jalview.bin.ArgParser.Arg;
import jalview.bin.ArgParser.BootstrapArgs;
-import jalview.util.FileUtils;
public class ArgParserTest
{
@Test(groups = "Functional", dataProvider = "argLines")
- public void parseArgsAndSubValsTest(String commandLineArgs)
+ public void parseArgsAndSubValsTest(String commandLineArgs, Arg a,
+ String other)
{
String[] args = commandLineArgs.split("\\s*");
ArgParser argparser = new ArgParser(args);
{
Properties bP = Cache.bootstrapProperties(b.get(Arg.PROPS));
Assert.assertTrue(other.equals(bP.get(Cache.BOOTSTRAP_TEST)));
+ Assert.assertFalse(bP.contains("NOT" + Cache.BOOTSTRAP_TEST));
}
else if (a == Arg.ARGFILE)
{
- List<File> files = FileUtils.getFilesFromGlob(b.get(a));
+ List<String> filenames = b.getList(a);
boolean found = false;
- for (File f : files)
+ for (String s : filenames)
{
+ File f = new File(s);
File fo = new File(other);
try
{
{
}
}
- Assert.assertTrue(found);
+ Assert.assertTrue(found,
+ "File '" + other + "' not found in shell expanded glob '"
+ + commandLineArgs + "'");
}
}
@Test(groups = "Functional", dataProvider = "argFiles")
- public void argFilesTest(String commandLineArgs, Arg a)
+ public void argFilesTest(String commandLineArgs, Arg a, String other)
{
String[] args = commandLineArgs.split("\\s+");
BootstrapArgs b = BootstrapArgs.getBootstrapArgs(args);
Assert.assertTrue(b.contains(a));
+ Assert.assertFalse(b.contains(Arg.OPEN));
if (a == Arg.PROPS)
{
Properties bP = Cache.bootstrapProperties(b.get(Arg.PROPS));
Assert.assertTrue("true".equals(bP.get(Cache.BOOTSTRAP_TEST)));
}
+ }
+ @DataProvider(name = "argLinesTest")
+ public Object[][] argLinesTest()
+ {
+ return new Object[][] {
+ // can't use this one yet as it doesn't get shell expanded
+ { "--argfile test/jalview/bin/argparser/argfile*.txt", Arg.ARGFILE,
+ "test/jalview/bin/argparser/argfile0.txt" }, };
}
@DataProvider(name = "argLines")
{ "--open=test/jalview/bin/argparser/test1.fa --props=test/jalview/bin/argparser/testProps.jvprops",
Arg.PROPS, "true" },
{ "--argfile=test/jalview/bin/argparser/argfile*.txt", Arg.ARGFILE,
- "test/jalview/bin/argparser/argfile1.txt" } };
+ "test/jalview/bin/argparser/argfile0.txt" },
+ { "--argfile=test/jalview/bin/argparser/argfile*.txt", Arg.ARGFILE,
+ "test/jalview/bin/argparser/argfile1.txt" },
+ { "--argfile=test/jalview/bin/argparser/argfile*.txt", Arg.ARGFILE,
+ "test/jalview/bin/argparser/argfile2.txt" } };
}
@DataProvider(name = "argFiles")
public Object[][] argFiles()
{
- return new Object[][] {
- { "--argfile=test/jalview/bin/argparser/argfile0.txt", Arg.OPEN,
- "test/jalview/bin/argfiles/test1.fa" } };
+ return new Object[][] { {
+ "--argfile=test/jalview/bin/argparser/argfile0.txt --open=shouldntbeabootstrap",
+ Arg.ARGFILE, "test/jalview/bin/argfiles/test1.fa" } };
}
}