bloritsch    02/01/10 08:01:42

  Modified:    src/test/org/apache/avalon/excalibur/cli/test
                        ClutilTestCase.java
  Log:
  add a test to make sure short options that only differ in case are considered 
unique
  
  Revision  Changes    Path
  1.10      +10 -3     
jakarta-avalon-excalibur/src/test/org/apache/avalon/excalibur/cli/test/ClutilTestCase.java
  
  Index: ClutilTestCase.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-excalibur/src/test/org/apache/avalon/excalibur/cli/test/ClutilTestCase.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ClutilTestCase.java       11 Dec 2001 09:53:38 -0000      1.9
  +++ ClutilTestCase.java       10 Jan 2002 16:01:42 -0000      1.10
  @@ -39,7 +39,7 @@
   
       private final static String[] ARGLIST2 =
       {
  -        "-Dstupid=idiot","are","--all","here"
  +        "-Dstupid=idiot","are","--all","here","-d"
       };
   
       private final static String[] ARGLIST3 =
  @@ -60,6 +60,7 @@
       };
   
       private static final int                DEFINE_OPT        = 'D';
  +    private static final int                CASE_CHECK_OPT    = 'd';
       private static final int                YOU_OPT           = 'y';
       private static final int                ALL_OPT           = 'a';
       private static final int                CLEAR1_OPT        = 'c';
  @@ -75,6 +76,11 @@
                                   CLOptionDescriptor.ARGUMENTS_REQUIRED_2,
                                   DEFINE_OPT,
                                   "define" );
  +    private final static CLOptionDescriptor CASE_CHECK      =
  +        new CLOptionDescriptor( "charCheck",
  +                                CLOptionDescriptor.ARGUMENT_DISALLOWED,
  +                                CASE_CHECK_OPT,
  +                                "check character case sensitivity");
       private final static CLOptionDescriptor YOU             =
           new CLOptionDescriptor( "you", 
CLOptionDescriptor.ARGUMENT_DISALLOWED, YOU_OPT, "you" );
   
  @@ -301,7 +307,7 @@
           //"-Dstupid=idiot","are","--all","here"
           final CLOptionDescriptor[] options = new CLOptionDescriptor[]
           {
  -            DEFINE, ALL, CLEAR1
  +            DEFINE, ALL, CLEAR1, CASE_CHECK
           };
   
           final CLArgsParser parser = new CLArgsParser( ARGLIST2, options );
  @@ -311,11 +317,12 @@
           final List clOptions = parser.getArguments();
           final int size = clOptions.size();
   
  -        assertEquals( size, 4 );
  +        assertEquals( size, 5 );
           assertEquals( ((CLOption)clOptions.get( 0 )).getId(), DEFINE_OPT );
           assertEquals( ((CLOption)clOptions.get( 1 )).getId(), 0 );
           assertEquals( ((CLOption)clOptions.get( 2 )).getId(), ALL_OPT );
           assertEquals( ((CLOption)clOptions.get( 3 )).getId(), 0 );
  +        assertEquals( ((CLOption)clOptions.get( 4 )).getId(), CASE_CHECK_OPT 
);
   
           final CLOption option = (CLOption)clOptions.get( 0 );
           assertEquals( "stupid", option.getArgument( 0 ) );
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to