X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=test%2Fjalview%2Fbin%2Fargparser%2FArgParserTest.java;h=442812e2ade6c2f3e32fe09a4331b7cf7d9196e0;hb=3d998cf52e272c70873c44c7672bc1270cafbf10;hp=9beba17ced8a738c6cc0c69207961f93d6b05a4c;hpb=31aca2e9990ff33e088faa41419bb60014a6fbcf;p=jalview.git diff --git a/test/jalview/bin/argparser/ArgParserTest.java b/test/jalview/bin/argparser/ArgParserTest.java index 9beba17..442812e 100644 --- a/test/jalview/bin/argparser/ArgParserTest.java +++ b/test/jalview/bin/argparser/ArgParserTest.java @@ -1,3 +1,23 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. + */ package jalview.bin.argparser; import java.io.File; @@ -279,9 +299,15 @@ public class ArgParserTest } @Test(groups = "Functional", dataProvider = "allLinkedIdsData") - public void allLinkedIdsTest(String commandLineArgs, Arg a, + public void allLinkedIdsTest(String pwd, String commandLineArgs, Arg a, String[] values, String[] nonvalues) { + String userDir = System.getProperty("user.dir"); + if (pwd != null) + { + File pwdFile = new File(pwd); + System.setProperty("user.dir", pwdFile.getAbsolutePath()); + } String[] args = commandLineArgs.split("\\s+"); ArgParser argparser = new ArgParser(args); @@ -306,12 +332,13 @@ public class ArgParserTest ArgValues avs = avm.getArgValues(a); ArgValue av = avs.getArgValue(); String v = av.getValue(); - value = new File(value).getAbsolutePath(); + value = new File(value).getPath(); Assert.assertEquals(v, value, "Arg value for " + a.argString() + " not applied correctly to linkedId '" + linkedId + "'"); } } + System.setProperty("user.dir", userDir); } @DataProvider(name = "allLinkedIdsData") @@ -321,22 +348,33 @@ public class ArgParserTest // /* */ - { "--open=test/jalview/bin/argparser/testfiles/*.fa --substitutions --all --image={dirname}/{basename}.png --close", + { null, + "--open=test/jalview/bin/argparser/testfiles/*.fa --substitutions --all --image={dirname}/{basename}.png --close", Arg.CLOSE, new String[] { null, null, null }, null }, - { "--open=test/jalview/bin/argparser/testfiles/*.fa --substitutions --all --output={dirname}/{basename}.stk --close", + { null, + "--open=test/jalview/bin/argparser/testfiles/*.fa --substitutions --all --output={dirname}/{basename}.stk --close", Arg.OUTPUT, new String[] { "test/jalview/bin/argparser/testfiles/test1.stk", "test/jalview/bin/argparser/testfiles/test2.stk", "test/jalview/bin/argparser/testfiles/test3.stk", }, null }, - { "--open=test/jalview/bin/argparser/testfiles/*.fa --substitutions --all --image={dirname}/{basename}.png --close", + { null, + "--open=test/jalview/bin/argparser/testfiles/*.fa --substitutions --all --image={dirname}/{basename}.png --close", Arg.IMAGE, new String[] { "test/jalview/bin/argparser/testfiles/test1.png", "test/jalview/bin/argparser/testfiles/test2.png", "test/jalview/bin/argparser/testfiles/test3.png", }, null }, + /* + * Find a way to change pwd reliably -- need to match "*.fa" against some files! + { "test/jalview/bin/argparser/testfiles", + + "--open=*.fa --image={dirname}/{basename}.png --close", + Arg.IMAGE, new String[] + { "./test1.png", "./test2.png", "./test3.png", }, null }, + */ // }; } @@ -414,4 +452,4 @@ public class ArgParserTest }; } -} +} \ No newline at end of file