JAL-629 Much better way of dealing with list of filenames/URLs without an --open...
[jalview.git] / test / jalview / bin / CommandLineOperationsNG.java
index ef2f78a..56d4300 100644 (file)
@@ -162,6 +162,12 @@ public class CommandLineOperationsNG
   private Worker getJalviewDesktopRunner(boolean withAwt, String cmd,
           int timeout)
   {
+    return getJalviewDesktopRunner(withAwt, cmd, timeout, true);
+  }
+
+  private Worker getJalviewDesktopRunner(boolean withAwt, String cmd,
+          int timeout, boolean testoutput)
+  {
     /*
     boolean win = System.getProperty("os.name").indexOf("Win") >= 0;
     String pwd = "";
@@ -194,7 +200,7 @@ public class CommandLineOperationsNG
     Worker worker = null;
     try
     {
-      cmd = " --testoutput " + cmd;
+      cmd = cmd + (testoutput ? " --testoutput " : "");
       System.out.println("Running '" + _cmd + cmd + "'");
       ls2_proc = Runtime.getRuntime().exec(_cmd + cmd);
     } catch (Throwable e1)
@@ -378,7 +384,7 @@ public class CommandLineOperationsNG
   {
     String cmd = args;
     File file = new File(comparisonFile);
-    Worker worker = getJalviewDesktopRunner(true, cmd, timeout);
+    Worker worker = getJalviewDesktopRunner(true, cmd, timeout, false);
     int b = -1;
     StringBuilder sb = new StringBuilder();
     try
@@ -504,7 +510,7 @@ public class CommandLineOperationsNG
     // when running tests on build server, but we will keep this patch for now
     // since it works.
     // https://issues.jalview.org/browse/JAL-1889?focusedCommentId=21609&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-21609
-    String workingDir = "test/jalview/bin/";
+    String workingDir = "test/jalview/bin";
     return new Object[][] {
         //
         { "--open=examples/uniref50.fa --output=-",
@@ -515,6 +521,16 @@ public class CommandLineOperationsNG
             workingDir + "/uniref50-output.blc", TEST_TIMEOUT },
         { "--open examples/uniref50.fa --output - --format blc",
             workingDir + "/uniref50-output.blc", TEST_TIMEOUT },
+        { "./examples/uniref50.fa --output=-",
+            workingDir + "/uniref50-output.fa", TEST_TIMEOUT },
+        { "./examples/uniref50.fa --output - --format blc",
+            workingDir + "/uniref50-output.blc", TEST_TIMEOUT },
+        // remember you can't use shell wildcards for filenames in a test
+        { "./test/jalview/bin/argparser/testfiles/test1.fa ./test/jalview/bin/argparser/testfiles/test2.fa ./test/jalview/bin/argparser/testfiles/test3.fa --all --output -",
+            workingDir + "/test1-3.fa", TEST_TIMEOUT },
+        // but you can use java wildcards when using an equals sign
+        { "--open=./test/jalview/bin/argparser/testfiles/test*.fa --all --output -",
+            workingDir + "/test1-3.fa", TEST_TIMEOUT },
         //
     };
   }