Return-Path: Delivered-To: apmail-commons-commits-archive@locus.apache.org Received: (qmail 85704 invoked from network); 27 Oct 2007 18:35:27 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 27 Oct 2007 18:35:27 -0000 Received: (qmail 28585 invoked by uid 500); 27 Oct 2007 18:35:13 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 28523 invoked by uid 500); 27 Oct 2007 18:35:13 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 28514 invoked by uid 99); 27 Oct 2007 18:35:13 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 27 Oct 2007 11:35:13 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 27 Oct 2007 18:35:28 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 296A41A9832; Sat, 27 Oct 2007 11:35:03 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r589173 - /commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/bug/BugCLI138Test.java Date: Sat, 27 Oct 2007 18:35:02 -0000 To: commits@commons.apache.org From: bayard@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20071027183503.296A41A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: bayard Date: Sat Oct 27 11:35:02 2007 New Revision: 589173 URL: http://svn.apache.org/viewvc?rev=589173&view=rev Log: Adding Brian's workaround tests from CLI-148 Added: commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/bug/BugCLI138Test.java (with props) Added: commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/bug/BugCLI138Test.java URL: http://svn.apache.org/viewvc/commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/bug/BugCLI138Test.java?rev=589173&view=auto ============================================================================== --- commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/bug/BugCLI138Test.java (added) +++ commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/bug/BugCLI138Test.java Sat Oct 27 11:35:02 2007 @@ -0,0 +1,59 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.commons.cli.bug; + +import org.apache.commons.cli.*; +import junit.framework.TestCase; + +/** + * http://issues.apache.org/jira/browse/CLI-138 + * + * @author brianegge + */ +public class BugCLI138Test extends TestCase { + + public void testWorkaround1() throws Exception + { + Options options = buildCommandLineOptions(); + CommandLineParser parser = new PosixParser(); + String[] args = new String[] {"-t-something" }; + CommandLine commandLine; + commandLine = parser.parse( options, args ); + assertEquals("-something", commandLine.getOptionValue( 't')); + } + + public void testWorkaround2() throws Exception + { + Options options = buildCommandLineOptions(); + CommandLineParser parser = new PosixParser(); + String[] args = new String[] {"-t", "\"-something\"" }; + CommandLine commandLine; + commandLine = parser.parse( options, args ); + assertEquals("-something", commandLine.getOptionValue( 't')); + } + + private Options buildCommandLineOptions() + { + Option t = OptionBuilder.withArgName( "t").hasArg().create('t'); + Option s = OptionBuilder.withArgName( "s").hasArg().create('s'); + Options options = new Options(); + options.addOption( t); + options.addOption( s); + return options; + } + +} Propchange: commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/bug/BugCLI138Test.java ------------------------------------------------------------------------------ svn:eol-style = native