Path: blob/master/test/langtools/jdk/javadoc/doclet/testCharset/TestCharset.java
40971 views
/*1* Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/*24* @test25* @bug 7052170 804774526* @summary Run a test on -charset to make sure the charset gets generated as a27* part of the meta tag.28* @library ../../lib29* @modules jdk.javadoc/jdk.javadoc.internal.tool30* @build javadoc.tester.*31* @run main TestCharset32*/3334import javadoc.tester.JavadocTester;3536public class TestCharset extends JavadocTester {3738public static void main(String... args) throws Exception {39TestCharset tester = new TestCharset();40tester.runTests();41}4243@Test44public void test() {45javadoc("-d", "out",46"-charset", "ISO-8859-1",47"-sourcepath", testSrc,48"pkg");49checkExit(Exit.OK);5051checkOutput("index.html", true,52"""53<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">""");54checkOutput("pkg/Foo.html", true,55"""56<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">""");5758checkOutput("index.html", false,59"""60<meta http-equiv="Content-Type" content="text/html" charset="ISO-8859-1">""");61checkOutput("pkg/Foo.html", false,62"""63<meta http-equiv="Content-Type" content="text/html" charset="ISO-8859-1">""");64}6566@Test67public void test1() {68javadoc("-d", "out-1",69"-sourcepath", testSrc,70"pkg");71checkExit(Exit.OK);7273checkOutput("index.html", true,74"""75<meta http-equiv="Content-Type" content="text/html; charset=utf-8">""");76checkOutput("pkg/Foo.html", true,77"""78<meta http-equiv="Content-Type" content="text/html; charset=utf-8">""");79}80}818283