Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add unit test for a mis-reported bug

  • Loading branch information...
commit 48ae2fc0dfd2e419630f4e973e8235473ad667f2 1 parent b344b04
@purcell authored
View
2  src/jargs/examples/gnu/OptionTest.java
@@ -36,7 +36,7 @@ public static void main( String[] args ) {
// Here, we add --alt and --name options.
CmdLineParser.Option alt = parser.addBooleanOption("alt");
- CmdLineParser.Option name = parser.addStringOption("name");
+ CmdLineParser.Option name = parser.addStringOption('n', "name");
// Next, you must parse the user-provided command line arguments, and
View
7 src/jargs/test/gnu/CmdLineParserTestCase.java
@@ -240,6 +240,13 @@ public void testMissingValueForStringOption() throws Exception {
} catch (CmdLineParser.IllegalOptionValueException e) {
}
}
+
+ public void testWhitespaceValueForStringOption() throws Exception {
+ CmdLineParser parser = new CmdLineParser();
+ CmdLineParser.Option opt = parser.addStringOption('o', "option");
+ parser.parse(new String[] {"-o", " "});
+ assertEquals(" ", parser.getOptionValue(opt));
+ }
private void assertArrayEquals(Object[] expected, Object[] actual) {
assertNotNull(actual);
Please sign in to comment.
Something went wrong with that request. Please try again.