Fri, 24 Apr 2020 03:58:51 +0100
Merge
vromero@1591 | 1 | /* |
vromero@1591 | 2 | * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
vromero@1591 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
vromero@1591 | 4 | * |
vromero@1591 | 5 | * This code is free software; you can redistribute it and/or modify it |
vromero@1591 | 6 | * under the terms of the GNU General Public License version 2 only, as |
vromero@1591 | 7 | * published by the Free Software Foundation. |
vromero@1591 | 8 | * |
vromero@1591 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
vromero@1591 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
vromero@1591 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
vromero@1591 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
vromero@1591 | 13 | * accompanied this code). |
vromero@1591 | 14 | * |
vromero@1591 | 15 | * You should have received a copy of the GNU General Public License version |
vromero@1591 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
vromero@1591 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
vromero@1591 | 18 | * |
vromero@1591 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
vromero@1591 | 20 | * or visit www.oracle.com if you need additional information or have any |
vromero@1591 | 21 | * questions. |
vromero@1591 | 22 | */ |
vromero@1591 | 23 | |
vromero@1591 | 24 | /* |
vromero@1591 | 25 | * @test |
vromero@1591 | 26 | * @bug 4110560 4785453 |
vromero@1591 | 27 | * @summary portability : javac.properties |
vromero@1591 | 28 | * @library /tools/javac/lib |
vromero@1591 | 29 | * @build ToolBox |
vromero@1591 | 30 | * @run main NewLineTest |
vromero@1591 | 31 | */ |
vromero@1591 | 32 | |
vromero@1591 | 33 | import java.io.File; |
vromero@1591 | 34 | import java.nio.charset.Charset; |
vromero@1591 | 35 | import java.nio.file.Files; |
vromero@1591 | 36 | import java.util.List; |
vromero@1591 | 37 | |
vromero@1591 | 38 | //original test: test/tools/javac/newlines/Newlines.sh |
vromero@1591 | 39 | public class NewLineTest { |
vromero@1591 | 40 | |
vromero@1591 | 41 | public static void main(String args[]) throws Exception { |
vromero@1591 | 42 | // "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -J-Dline.separator='@' > ${TMP1} 2>&1 |
vromero@1591 | 43 | File javacErrOutput = new File("output.txt"); |
vromero@1591 | 44 | ToolBox.AnyToolArgs cmdArgs = |
vromero@1591 | 45 | new ToolBox.AnyToolArgs(ToolBox.Expect.FAIL) |
vromero@1637 | 46 | .appendArgs(ToolBox.javacBinary) |
vromero@1637 | 47 | .appendArgs(ToolBox.testToolVMOpts) |
vromero@1637 | 48 | .appendArgs("-J-Dline.separator='@'") |
vromero@1591 | 49 | .setErrOutput(javacErrOutput); |
vromero@1591 | 50 | ToolBox.executeCommand(cmdArgs); |
vromero@1591 | 51 | |
vromero@1591 | 52 | // result=`cat ${TMP1} | wc -l` |
vromero@1591 | 53 | // if [ "$result" -eq 0 ] passed |
vromero@1591 | 54 | List<String> lines = Files.readAllLines(javacErrOutput.toPath(), |
vromero@1591 | 55 | Charset.defaultCharset()); |
vromero@1591 | 56 | if (lines.size() != 1) { |
vromero@1591 | 57 | throw new AssertionError("The compiler output should have one line only"); |
vromero@1591 | 58 | } |
vromero@1591 | 59 | } |
vromero@1591 | 60 | |
vromero@1591 | 61 | } |