commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sgoes...@apache.org
Subject svn commit: r651237 - /commons/sandbox/exec/trunk/src/test/java/org/apache/commons/exec/CommandLineTest.java
Date Thu, 24 Apr 2008 12:13:02 GMT
Author: sgoeschl
Date: Thu Apr 24 05:13:00 2008
New Revision: 651237

URL: http://svn.apache.org/viewvc?rev=651237&view=rev
Log:
Updating the tests to pin down a quoting problem

Modified:
    commons/sandbox/exec/trunk/src/test/java/org/apache/commons/exec/CommandLineTest.java

Modified: commons/sandbox/exec/trunk/src/test/java/org/apache/commons/exec/CommandLineTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/exec/trunk/src/test/java/org/apache/commons/exec/CommandLineTest.java?rev=651237&r1=651236&r2=651237&view=diff
==============================================================================
--- commons/sandbox/exec/trunk/src/test/java/org/apache/commons/exec/CommandLineTest.java
(original)
+++ commons/sandbox/exec/trunk/src/test/java/org/apache/commons/exec/CommandLineTest.java
Thu Apr 24 05:13:00 2008
@@ -166,19 +166,19 @@
         assertEquals(new String[] {"test"}, cmdl.toStrings());
     }
 
-    public void testParse() {
+    public void testParseCommandLine() {
         CommandLine cmdl = CommandLine.parse("test foo bar");
         assertEquals("test foo bar", cmdl.toString());
         assertEquals(new String[] {"test", "foo", "bar"}, cmdl.toStrings());
     }
 
-    public void testParseWithQuotes() {
+    public void testParseCommandLineWithQuotes() {
         CommandLine cmdl = CommandLine.parse("test \"foo\" \'ba r\'");
         assertEquals("test foo \"ba r\"", cmdl.toString());
         assertEquals(new String[] {"test", "foo", "\"ba r\""}, cmdl.toStrings());
     }
 
-    public void testParseWithUnevenQuotes() {
+    public void testParseCommandLineWithUnevenQuotes() {
         try {
             CommandLine.parse("test \"foo bar");
             fail("IllegalArgumentException must be thrown due to uneven quotes");
@@ -187,7 +187,7 @@
         }
     }
 
-    public void testParseWithNull() {
+    public void testParseCommandLineWithNull() {
         try {
             CommandLine.parse(null);
             fail("IllegalArgumentException must be thrown due to incorrect command line");
@@ -196,13 +196,22 @@
         }
     }
 
-    public void testParseWithOnlyWhitespace() {
+    public void testParseCommandLineWithOnlyWhitespace() {
         try {
             CommandLine.parse("  ");
             fail("IllegalArgumentException must be thrown due to incorrect command line");
         } catch (IllegalArgumentException e) {
             // Expected
         }
+    }
+
+    public void _testParseComplexCommandLine1() throws Exception {
+        HashMap substitutionMap = new HashMap();
+        substitutionMap.put("in", "source.jpg");
+        substitutionMap.put("out", "target.jpg");
+        CommandLine cmdl = CommandLine.parse("cmd /C convert ${in} -resize \"\'500x>\'\"
${out}", substitutionMap);
+        assertEquals("cmd /C convert source.jpg -resize \"500x>\" target.jpg", cmdl.toString());
+        return;
     }
 
    /**



Mime
View raw message