langtools/test/tools/javap/InvalidOptions.java
changeset 22698 818555741cd5
parent 21706 5b69542c19b3
child 30730 d3ce7619db2c
equal deleted inserted replaced
22697:2a39af0e7d34 22698:818555741cd5
     1 /*
     1 /*
     2  * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    21  * questions.
    21  * questions.
    22  */
    22  */
    23 
    23 
    24 /*
    24 /*
    25  * @test
    25  * @test
    26  * @bug 8027411
    26  * @bug 8027411 8032869
    27  * @summary test invalid options -h and -b
    27  * @summary test an invalid option
    28  */
    28  */
    29 
    29 
    30 import java.io.*;
    30 import java.io.*;
    31 import java.util.zip.*;
    31 import java.util.zip.*;
    32 
    32 
    37     public static void main(String[] args) throws Exception {
    37     public static void main(String[] args) throws Exception {
    38         new InvalidOptions().run();
    38         new InvalidOptions().run();
    39     }
    39     }
    40 
    40 
    41     void run() throws Exception {
    41     void run() throws Exception {
    42         test(2, "-h", "Error: -h is no longer available - use the javah program");
       
    43         test(2, "-b", "Error: unknown option: -b",
    42         test(2, "-b", "Error: unknown option: -b",
    44                       "Usage: javap <options> <classes>",
    43                       "Usage: javap <options> <classes>",
    45                       "use -help for a list of possible options");
    44                       "use -help for a list of possible options");
    46         if (errorCount > 0)
    45         if (errorCount > 0)
    47             throw new Exception(errorCount + " errors received");
    46             throw new Exception(errorCount + " errors received");