InfoOptsTest.java revision 3117:404f1956145b
1234949Sbapt/* 2234949Sbapt * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. 3234949Sbapt * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4234949Sbapt * 5234949Sbapt * This code is free software; you can redistribute it and/or modify it 6234949Sbapt * under the terms of the GNU General Public License version 2 only, as 7234949Sbapt * published by the Free Software Foundation. 8234949Sbapt * 9234949Sbapt * This code is distributed in the hope that it will be useful, but WITHOUT 10234949Sbapt * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11234949Sbapt * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12234949Sbapt * version 2 for more details (a copy is included in the LICENSE file that 13234949Sbapt * accompanied this code). 14234949Sbapt * 15234949Sbapt * You should have received a copy of the GNU General Public License version 16234949Sbapt * 2 along with this work; if not, write to the Free Software Foundation, 17234949Sbapt * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18234949Sbapt * 19234949Sbapt * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20234949Sbapt * or visit www.oracle.com if you need additional information or have any 21234949Sbapt * questions. 22234949Sbapt */ 23234949Sbapt 24234949Sbapt/* 25234949Sbapt * @test 26234949Sbapt * @bug 8044859 27234949Sbapt * @summary test support for info options -help -X -version -fullversion 28234949Sbapt * @modules jdk.compiler/com.sun.tools.javac.api 29234949Sbapt * jdk.compiler/com.sun.tools.javac.file 30234949Sbapt * jdk.compiler/com.sun.tools.javac.main 31234949Sbapt * jdk.compiler/com.sun.tools.javac.util 32234949Sbapt * @build Tester 33234949Sbapt * @run main InfoOptsTest 34234949Sbapt */ 35234949Sbapt 36234949Sbaptimport java.io.IOException; 37234949Sbapt 38234949Sbaptpublic class InfoOptsTest extends Tester { 39234949Sbapt public static void main(String... args) throws Exception { 40234949Sbapt InfoOptsTest t = new InfoOptsTest(); 41234949Sbapt t.runTests(); 42234949Sbapt } 43234949Sbapt 44234949Sbapt @Test 45234949Sbapt void testInfoOpts() throws IOException { 46234949Sbapt testInfoOpt("-help", "-deprecation"); 47234949Sbapt testInfoOpt("-X", "-Xlint"); 48234949Sbapt 49234949Sbapt String specVersion = System.getProperty("java.specification.version"); 50234949Sbapt testInfoOpt("-version", "javac", specVersion); 51234949Sbapt testInfoOpt("-fullversion", "javac", specVersion, "+"); 52234949Sbapt } 53234949Sbapt 54234949Sbapt void testInfoOpt(String opt, String... expect) { 55234949Sbapt String[] opts = { opt }; 56234949Sbapt String[] files = { }; 57234949Sbapt 58234949Sbapt runMain(opts, files) 59234949Sbapt .checkOK() 60234949Sbapt .checkLog(expect); 61234949Sbapt 62234949Sbapt runCall(opts, files) 63234949Sbapt .checkIllegalArgumentException(); 64234949Sbapt 65234949Sbapt runParse(opts, files) 66234949Sbapt .checkIllegalArgumentException(); 67234949Sbapt } 68234949Sbapt} 69234949Sbapt