[prev in list] [next in list] [prev in thread] [next in thread]
List: jakarta-commons-dev
Subject: svn commit: r661807 -
From: ebourg () apache ! org
Date: 2008-05-30 18:27:39
Message-ID: 20080530182739.7F1CC23889FA () eris ! apache ! org
[Download RAW message or body]
Author: ebourg
Date: Fri May 30 11:27:38 2008
New Revision: 661807
URL: http://svn.apache.org/viewvc?rev=661807&view=rev
Log:
Added a test for parsing negative values with GnuParser
Modified:
commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/GnuParseTest.java
Modified: commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/GnuParseTest.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/GnuParseTest.java?rev=661807&r1=661806&r2=661807&view=diff
==============================================================================
--- commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/GnuParseTest.java \
(original)
+++ commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/GnuParseTest.java \
Fri May 30 11:27:38 2008 @@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.commons.cli;
import junit.framework.TestCase;
@@ -192,4 +193,16 @@
assertTrue( "Confirm 1 extra arg: " + cl.getArgList().size(), \
cl.getArgList().size() == 1);
assertTrue( "Confirm value of extra arg: " + cl.getArgList().get(0), \
cl.getArgList().get(0).equals("-") ); }
+
+ public void testNegativeArgument() throws Exception
+ {
+ String[] args = new String[] { "-a", "-1"} ;
+
+ Options options = new Options();
+ options.addOption(OptionBuilder.hasArg().create("a"));
+
+ Parser parser = new GnuParser();
+ CommandLine cl = parser.parse(options, args);
+ assertEquals("-1", cl.getOptionValue("a"));
+ }
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic