test/langtools/jdk/jshell/StartOptionTest.java
author rfield
Thu, 02 Nov 2017 11:09:28 -0700 (2017-11-02)
changeset 47517 b5ad886110b3
parent 47504 58ce36f43f1a
child 47840 e0f08a49f3e3
permissions -rw-r--r--
8188072: JShell: NPE in SourceCodeAnalysis.completionSuggestions() Reviewed-by: jlahoda
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
33362
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
     1
/*
44683
610dc2b48954 8178023: jshell tool: crash with ugly message on attempt to add non-existant module path
rfield
parents: 43367
diff changeset
     2
 * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
33362
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
     4
 *
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
     7
 * published by the Free Software Foundation.
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
     8
 *
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
    13
 * accompanied this code).
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
    14
 *
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
    18
 *
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
    21
 * questions.
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
    22
 */
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
    23
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
    24
/*
47504
58ce36f43f1a 8179856: jshell tool: not suitable for pipeline use
rfield
parents: 47216
diff changeset
    25
 * @test 8151754 8080883 8160089 8170162 8166581 8172102 8171343 8178023 8186708 8179856
33362
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
    26
 * @summary Testing start-up options.
35359
f04501964016 8148147: Sync up @modules from jigsaw/jake
alanb
parents: 33362
diff changeset
    27
 * @modules jdk.compiler/com.sun.tools.javac.api
f04501964016 8148147: Sync up @modules from jigsaw/jake
alanb
parents: 33362
diff changeset
    28
 *          jdk.compiler/com.sun.tools.javac.main
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35359
diff changeset
    29
 *          jdk.jdeps/com.sun.tools.javap
35359
f04501964016 8148147: Sync up @modules from jigsaw/jake
alanb
parents: 33362
diff changeset
    30
 *          jdk.jshell/jdk.internal.jshell.tool
33362
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
    31
 * @library /tools/lib
36778
e04318f39f92 8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents: 36715
diff changeset
    32
 * @build Compiler toolbox.ToolBox
33362
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
    33
 * @run testng StartOptionTest
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
    34
 */
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
    35
43367
7797472a9ed5 8171343: jshell tool: missing options: --help-extra --show-version
rfield
parents: 42972
diff changeset
    36
import java.io.ByteArrayInputStream;
33362
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
    37
import java.io.ByteArrayOutputStream;
43367
7797472a9ed5 8171343: jshell tool: missing options: --help-extra --show-version
rfield
parents: 42972
diff changeset
    38
import java.io.InputStream;
33362
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
    39
import java.io.PrintStream;
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
    40
import java.nio.charset.StandardCharsets;
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
    41
import java.nio.file.Path;
41641
a628785b9dd9 8167637: jshell tool: /edit should use EDITOR setting
rfield
parents: 40767
diff changeset
    42
import java.util.HashMap;
36990
ec0b843a7af5 8147515: JShell: Internationalize
rfield
parents: 36778
diff changeset
    43
import java.util.Locale;
33362
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
    44
import java.util.function.Consumer;
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
    45
44683
610dc2b48954 8178023: jshell tool: crash with ugly message on attempt to add non-existant module path
rfield
parents: 43367
diff changeset
    46
import java.util.logging.Level;
610dc2b48954 8178023: jshell tool: crash with ugly message on attempt to add non-existant module path
rfield
parents: 43367
diff changeset
    47
import java.util.logging.Logger;
33362
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
    48
import org.testng.annotations.AfterMethod;
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
    49
import org.testng.annotations.BeforeMethod;
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
    50
import org.testng.annotations.Test;
42843
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
    51
import jdk.jshell.tool.JavaShellToolBuilder;
33362
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
    52
import static org.testng.Assert.assertEquals;
43367
7797472a9ed5 8171343: jshell tool: missing options: --help-extra --show-version
rfield
parents: 42972
diff changeset
    53
import static org.testng.Assert.assertFalse;
33362
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
    54
import static org.testng.Assert.assertTrue;
42272
82e273c4f2b3 8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents: 41641
diff changeset
    55
import static org.testng.Assert.fail;
33362
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
    56
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
    57
@Test
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
    58
public class StartOptionTest {
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
    59
38608
691b607bbcd6 8157917: JShell: shutdown could cause remote JDWP errors to be visible to users
rfield
parents: 37745
diff changeset
    60
    private ByteArrayOutputStream cmdout;
691b607bbcd6 8157917: JShell: shutdown could cause remote JDWP errors to be visible to users
rfield
parents: 37745
diff changeset
    61
    private ByteArrayOutputStream cmderr;
691b607bbcd6 8157917: JShell: shutdown could cause remote JDWP errors to be visible to users
rfield
parents: 37745
diff changeset
    62
    private ByteArrayOutputStream console;
691b607bbcd6 8157917: JShell: shutdown could cause remote JDWP errors to be visible to users
rfield
parents: 37745
diff changeset
    63
    private ByteArrayOutputStream userout;
691b607bbcd6 8157917: JShell: shutdown could cause remote JDWP errors to be visible to users
rfield
parents: 37745
diff changeset
    64
    private ByteArrayOutputStream usererr;
43367
7797472a9ed5 8171343: jshell tool: missing options: --help-extra --show-version
rfield
parents: 42972
diff changeset
    65
    private InputStream cmdInStream;
33362
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
    66
42843
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
    67
    private JavaShellToolBuilder builder() {
44683
610dc2b48954 8178023: jshell tool: crash with ugly message on attempt to add non-existant module path
rfield
parents: 43367
diff changeset
    68
        // turn on logging of launch failures
610dc2b48954 8178023: jshell tool: crash with ugly message on attempt to add non-existant module path
rfield
parents: 43367
diff changeset
    69
        Logger.getLogger("jdk.jshell.execution").setLevel(Level.ALL);
42843
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
    70
        return JavaShellToolBuilder
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
    71
                    .builder()
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
    72
                    .out(new PrintStream(cmdout), new PrintStream(console), new PrintStream(userout))
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
    73
                    .err(new PrintStream(cmderr), new PrintStream(usererr))
43367
7797472a9ed5 8171343: jshell tool: missing options: --help-extra --show-version
rfield
parents: 42972
diff changeset
    74
                    .in(cmdInStream, null)
42843
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
    75
                    .persistence(new HashMap<>())
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
    76
                    .env(new HashMap<>())
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
    77
                    .locale(Locale.ROOT);
33362
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
    78
    }
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
    79
42843
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
    80
    private void runShell(String... args) {
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
    81
        try {
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
    82
            builder()
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
    83
                    .run(args);
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
    84
        } catch (Exception ex) {
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
    85
            fail("Repl tool died with exception", ex);
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
    86
        }
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
    87
    }
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
    88
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
    89
    protected void check(ByteArrayOutputStream str, Consumer<String> checkOut, String label) {
38608
691b607bbcd6 8157917: JShell: shutdown could cause remote JDWP errors to be visible to users
rfield
parents: 37745
diff changeset
    90
        byte[] bytes = str.toByteArray();
691b607bbcd6 8157917: JShell: shutdown could cause remote JDWP errors to be visible to users
rfield
parents: 37745
diff changeset
    91
        str.reset();
691b607bbcd6 8157917: JShell: shutdown could cause remote JDWP errors to be visible to users
rfield
parents: 37745
diff changeset
    92
        String out =  new String(bytes, StandardCharsets.UTF_8);
691b607bbcd6 8157917: JShell: shutdown could cause remote JDWP errors to be visible to users
rfield
parents: 37745
diff changeset
    93
        if (checkOut != null) {
691b607bbcd6 8157917: JShell: shutdown could cause remote JDWP errors to be visible to users
rfield
parents: 37745
diff changeset
    94
            checkOut.accept(out);
691b607bbcd6 8157917: JShell: shutdown could cause remote JDWP errors to be visible to users
rfield
parents: 37745
diff changeset
    95
        } else {
691b607bbcd6 8157917: JShell: shutdown could cause remote JDWP errors to be visible to users
rfield
parents: 37745
diff changeset
    96
            assertEquals("", out, label + ": Expected empty -- ");
691b607bbcd6 8157917: JShell: shutdown could cause remote JDWP errors to be visible to users
rfield
parents: 37745
diff changeset
    97
        }
33362
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
    98
    }
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
    99
42843
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
   100
    protected void start(Consumer<String> checkCmdOutput,
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
   101
            Consumer<String> checkUserOutput, Consumer<String> checkError,
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
   102
            String... args) throws Exception {
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
   103
        runShell(args);
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
   104
        check(cmdout, checkCmdOutput, "cmdout");
38608
691b607bbcd6 8157917: JShell: shutdown could cause remote JDWP errors to be visible to users
rfield
parents: 37745
diff changeset
   105
        check(cmderr, checkError, "cmderr");
691b607bbcd6 8157917: JShell: shutdown could cause remote JDWP errors to be visible to users
rfield
parents: 37745
diff changeset
   106
        check(console, null, "console");
42843
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
   107
        check(userout, checkUserOutput, "userout");
38608
691b607bbcd6 8157917: JShell: shutdown could cause remote JDWP errors to be visible to users
rfield
parents: 37745
diff changeset
   108
        check(usererr, null, "usererr");
33362
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
   109
    }
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
   110
42843
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
   111
    protected void start(String expectedCmdOutput, String expectedError, String... args) throws Exception {
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
   112
        startWithUserOutput(expectedCmdOutput, "",  expectedError, args);
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
   113
    }
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
   114
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
   115
    private void startWithUserOutput(String expectedCmdOutput, String expectedUserOutput,
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
   116
            String expectedError, String... args) throws Exception {
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
   117
        start(
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
   118
                s -> assertEquals(s.trim(), expectedCmdOutput, "cmdout: "),
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
   119
                s -> assertEquals(s.trim(), expectedUserOutput, "userout: "),
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
   120
                s -> assertEquals(s.trim(), expectedError, "cmderr: "),
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
   121
                args);
33362
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
   122
    }
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
   123
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
   124
    @BeforeMethod
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
   125
    public void setUp() {
38608
691b607bbcd6 8157917: JShell: shutdown could cause remote JDWP errors to be visible to users
rfield
parents: 37745
diff changeset
   126
        cmdout  = new ByteArrayOutputStream();
691b607bbcd6 8157917: JShell: shutdown could cause remote JDWP errors to be visible to users
rfield
parents: 37745
diff changeset
   127
        cmderr  = new ByteArrayOutputStream();
691b607bbcd6 8157917: JShell: shutdown could cause remote JDWP errors to be visible to users
rfield
parents: 37745
diff changeset
   128
        console = new ByteArrayOutputStream();
691b607bbcd6 8157917: JShell: shutdown could cause remote JDWP errors to be visible to users
rfield
parents: 37745
diff changeset
   129
        userout = new ByteArrayOutputStream();
691b607bbcd6 8157917: JShell: shutdown could cause remote JDWP errors to be visible to users
rfield
parents: 37745
diff changeset
   130
        usererr = new ByteArrayOutputStream();
43367
7797472a9ed5 8171343: jshell tool: missing options: --help-extra --show-version
rfield
parents: 42972
diff changeset
   131
        cmdInStream = new ByteArrayInputStream("/exit\n".getBytes());
33362
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
   132
    }
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
   133
42843
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
   134
    protected String writeToFile(String stuff) throws Exception {
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
   135
        Compiler compiler = new Compiler();
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
   136
        Path p = compiler.getPath("doit.repl");
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
   137
        compiler.writeToFile(p, stuff);
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
   138
        return p.toString();
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
   139
    }
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
   140
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
   141
    public void testCommandFile() throws Exception {
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
   142
        String fn = writeToFile("String str = \"Hello \"\n/list\nSystem.out.println(str + str)\n/exit\n");
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
   143
        startWithUserOutput("1 : String str = \"Hello \";", "Hello Hello", "", "--no-startup", fn, "-s");
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
   144
    }
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
   145
33362
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
   146
    public void testUsage() throws Exception {
40588
b5c32bfa9710 8160089: jshell tool: use new double-dash long-form command-line options
rfield
parents: 38613
diff changeset
   147
        for (String opt : new String[]{"-h", "--help"}) {
b5c32bfa9710 8160089: jshell tool: use new double-dash long-form command-line options
rfield
parents: 38613
diff changeset
   148
            start(s -> {
b5c32bfa9710 8160089: jshell tool: use new double-dash long-form command-line options
rfield
parents: 38613
diff changeset
   149
                assertTrue(s.split("\n").length >= 7, "Not enough usage lines: " + s);
47504
58ce36f43f1a 8179856: jshell tool: not suitable for pipeline use
rfield
parents: 47216
diff changeset
   150
                assertTrue(s.startsWith("Usage:   jshell <option>..."), "Unexpect usage start: " + s);
43367
7797472a9ed5 8171343: jshell tool: missing options: --help-extra --show-version
rfield
parents: 42972
diff changeset
   151
                assertTrue(s.contains("--show-version"), "Expected help: " + s);
7797472a9ed5 8171343: jshell tool: missing options: --help-extra --show-version
rfield
parents: 42972
diff changeset
   152
                assertFalse(s.contains("Welcome"), "Unexpected start: " + s);
7797472a9ed5 8171343: jshell tool: missing options: --help-extra --show-version
rfield
parents: 42972
diff changeset
   153
            }, null, null, opt);
7797472a9ed5 8171343: jshell tool: missing options: --help-extra --show-version
rfield
parents: 42972
diff changeset
   154
        }
7797472a9ed5 8171343: jshell tool: missing options: --help-extra --show-version
rfield
parents: 42972
diff changeset
   155
    }
7797472a9ed5 8171343: jshell tool: missing options: --help-extra --show-version
rfield
parents: 42972
diff changeset
   156
7797472a9ed5 8171343: jshell tool: missing options: --help-extra --show-version
rfield
parents: 42972
diff changeset
   157
    public void testHelpExtra() throws Exception {
7797472a9ed5 8171343: jshell tool: missing options: --help-extra --show-version
rfield
parents: 42972
diff changeset
   158
        for (String opt : new String[]{"-X", "--help-extra"}) {
7797472a9ed5 8171343: jshell tool: missing options: --help-extra --show-version
rfield
parents: 42972
diff changeset
   159
            start(s -> {
7797472a9ed5 8171343: jshell tool: missing options: --help-extra --show-version
rfield
parents: 42972
diff changeset
   160
                assertTrue(s.split("\n").length >= 5, "Not enough help-extra lines: " + s);
7797472a9ed5 8171343: jshell tool: missing options: --help-extra --show-version
rfield
parents: 42972
diff changeset
   161
                assertTrue(s.contains("--add-exports"), "Expected --add-exports: " + s);
7797472a9ed5 8171343: jshell tool: missing options: --help-extra --show-version
rfield
parents: 42972
diff changeset
   162
                assertTrue(s.contains("--execution"), "Expected --add-exports: " + s);
7797472a9ed5 8171343: jshell tool: missing options: --help-extra --show-version
rfield
parents: 42972
diff changeset
   163
                assertFalse(s.contains("Welcome"), "Unexpected start: " + s);
42843
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
   164
            }, null, null, opt);
40588
b5c32bfa9710 8160089: jshell tool: use new double-dash long-form command-line options
rfield
parents: 38613
diff changeset
   165
        }
33362
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
   166
    }
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
   167
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
   168
    public void testUnknown() throws Exception {
42843
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
   169
        start(null, null,
40588
b5c32bfa9710 8160089: jshell tool: use new double-dash long-form command-line options
rfield
parents: 38613
diff changeset
   170
              s -> assertEquals(s.trim(), "Unknown option: u"), "-unknown");
42843
a8d83044a192 8170162: jshell tool: no mechanism to programmatically launch
rfield
parents: 42272
diff changeset
   171
        start(null, null,
40588
b5c32bfa9710 8160089: jshell tool: use new double-dash long-form command-line options
rfield
parents: 38613
diff changeset
   172
              s -> assertEquals(s.trim(), "Unknown option: unknown"), "--unknown");
33362
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
   173
    }
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
   174
47504
58ce36f43f1a 8179856: jshell tool: not suitable for pipeline use
rfield
parents: 47216
diff changeset
   175
    /**
58ce36f43f1a 8179856: jshell tool: not suitable for pipeline use
rfield
parents: 47216
diff changeset
   176
     * Test that input is read with "-" and there is no extra output.
58ce36f43f1a 8179856: jshell tool: not suitable for pipeline use
rfield
parents: 47216
diff changeset
   177
     * @throws Exception
58ce36f43f1a 8179856: jshell tool: not suitable for pipeline use
rfield
parents: 47216
diff changeset
   178
     */
58ce36f43f1a 8179856: jshell tool: not suitable for pipeline use
rfield
parents: 47216
diff changeset
   179
    public void testHypenFile() throws Exception {
58ce36f43f1a 8179856: jshell tool: not suitable for pipeline use
rfield
parents: 47216
diff changeset
   180
        cmdInStream = new ByteArrayInputStream("System.out.print(\"Hello\");\n".getBytes());
58ce36f43f1a 8179856: jshell tool: not suitable for pipeline use
rfield
parents: 47216
diff changeset
   181
        startWithUserOutput("", "Hello", "", "-");
58ce36f43f1a 8179856: jshell tool: not suitable for pipeline use
rfield
parents: 47216
diff changeset
   182
        cmdInStream = new ByteArrayInputStream("System.out.print(\"Hello\");\n".getBytes());
58ce36f43f1a 8179856: jshell tool: not suitable for pipeline use
rfield
parents: 47216
diff changeset
   183
        startWithUserOutput("", "Hello", "", "-", "-");
58ce36f43f1a 8179856: jshell tool: not suitable for pipeline use
rfield
parents: 47216
diff changeset
   184
        Compiler compiler = new Compiler();
58ce36f43f1a 8179856: jshell tool: not suitable for pipeline use
rfield
parents: 47216
diff changeset
   185
        Path path = compiler.getPath("markload.jsh");
58ce36f43f1a 8179856: jshell tool: not suitable for pipeline use
rfield
parents: 47216
diff changeset
   186
        compiler.writeToFile(path, "System.out.print(\"===\");");
58ce36f43f1a 8179856: jshell tool: not suitable for pipeline use
rfield
parents: 47216
diff changeset
   187
        cmdInStream = new ByteArrayInputStream("System.out.print(\"Hello\");\n".getBytes());
58ce36f43f1a 8179856: jshell tool: not suitable for pipeline use
rfield
parents: 47216
diff changeset
   188
        startWithUserOutput("", "===Hello===", "", path.toString(), "-", path.toString());
58ce36f43f1a 8179856: jshell tool: not suitable for pipeline use
rfield
parents: 47216
diff changeset
   189
        // check that errors go to standard error
58ce36f43f1a 8179856: jshell tool: not suitable for pipeline use
rfield
parents: 47216
diff changeset
   190
        cmdInStream = new ByteArrayInputStream(") Foobar".getBytes());
58ce36f43f1a 8179856: jshell tool: not suitable for pipeline use
rfield
parents: 47216
diff changeset
   191
        start(
58ce36f43f1a 8179856: jshell tool: not suitable for pipeline use
rfield
parents: 47216
diff changeset
   192
                s -> assertEquals(s.trim(), "", "cmdout: empty"),
58ce36f43f1a 8179856: jshell tool: not suitable for pipeline use
rfield
parents: 47216
diff changeset
   193
                s -> assertEquals(s.trim(), "", "userout: empty"),
58ce36f43f1a 8179856: jshell tool: not suitable for pipeline use
rfield
parents: 47216
diff changeset
   194
                s -> assertTrue(s.contains("illegal start of expression"),
58ce36f43f1a 8179856: jshell tool: not suitable for pipeline use
rfield
parents: 47216
diff changeset
   195
                            "cmderr: illegal start of expression"),
58ce36f43f1a 8179856: jshell tool: not suitable for pipeline use
rfield
parents: 47216
diff changeset
   196
                "-");
58ce36f43f1a 8179856: jshell tool: not suitable for pipeline use
rfield
parents: 47216
diff changeset
   197
    }
58ce36f43f1a 8179856: jshell tool: not suitable for pipeline use
rfield
parents: 47216
diff changeset
   198
58ce36f43f1a 8179856: jshell tool: not suitable for pipeline use
rfield
parents: 47216
diff changeset
   199
    /**
58ce36f43f1a 8179856: jshell tool: not suitable for pipeline use
rfield
parents: 47216
diff changeset
   200
     * Test that non-existent load file sends output to stderr and does not start (no welcome).
58ce36f43f1a 8179856: jshell tool: not suitable for pipeline use
rfield
parents: 47216
diff changeset
   201
     * @throws Exception
58ce36f43f1a 8179856: jshell tool: not suitable for pipeline use
rfield
parents: 47216
diff changeset
   202
     */
58ce36f43f1a 8179856: jshell tool: not suitable for pipeline use
rfield
parents: 47216
diff changeset
   203
    public void testUnknownLoadFile() throws Exception {
58ce36f43f1a 8179856: jshell tool: not suitable for pipeline use
rfield
parents: 47216
diff changeset
   204
        start("", "File 'UNKNOWN' for 'jshell' is not found.", "UNKNOWN");
58ce36f43f1a 8179856: jshell tool: not suitable for pipeline use
rfield
parents: 47216
diff changeset
   205
    }
58ce36f43f1a 8179856: jshell tool: not suitable for pipeline use
rfield
parents: 47216
diff changeset
   206
33362
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
   207
    public void testStartup() throws Exception {
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
   208
        Compiler compiler = new Compiler();
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
   209
        Path p = compiler.getPath("file.txt");
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
   210
        compiler.writeToFile(p);
40588
b5c32bfa9710 8160089: jshell tool: use new double-dash long-form command-line options
rfield
parents: 38613
diff changeset
   211
        start("", "Argument to startup missing.", "--startup");
42972
47ca49eee534 8172102: jshell tool: remove print method forwarding to System.out from default startup
rfield
parents: 42843
diff changeset
   212
        start("", "Conflicting options: both --startup and --no-startup were used.", "--no-startup", "--startup", p.toString());
47ca49eee534 8172102: jshell tool: remove print method forwarding to System.out from default startup
rfield
parents: 42843
diff changeset
   213
        start("", "Conflicting options: both --startup and --no-startup were used.", "--startup", p.toString(), "--no-startup");
40588
b5c32bfa9710 8160089: jshell tool: use new double-dash long-form command-line options
rfield
parents: 38613
diff changeset
   214
        start("", "Argument to startup missing.", "--no-startup", "--startup");
38613
2a8e50869b08 8157953: JShell tests: reenable ToolBasicTest
rfield
parents: 38608
diff changeset
   215
    }
2a8e50869b08 8157953: JShell tests: reenable ToolBasicTest
rfield
parents: 38608
diff changeset
   216
42272
82e273c4f2b3 8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents: 41641
diff changeset
   217
    public void testStartupFailedOption() throws Exception {
44683
610dc2b48954 8178023: jshell tool: crash with ugly message on attempt to add non-existant module path
rfield
parents: 43367
diff changeset
   218
        start(
610dc2b48954 8178023: jshell tool: crash with ugly message on attempt to add non-existant module path
rfield
parents: 43367
diff changeset
   219
                s -> assertEquals(s.trim(), "", "cmdout: "),
610dc2b48954 8178023: jshell tool: crash with ugly message on attempt to add non-existant module path
rfield
parents: 43367
diff changeset
   220
                s -> assertEquals(s.trim(), "", "userout: "),
610dc2b48954 8178023: jshell tool: crash with ugly message on attempt to add non-existant module path
rfield
parents: 43367
diff changeset
   221
                s -> assertTrue(s.contains("Unrecognized option: -hoge-foo-bar"), "cmderr: " + s),
610dc2b48954 8178023: jshell tool: crash with ugly message on attempt to add non-existant module path
rfield
parents: 43367
diff changeset
   222
                "-R-hoge-foo-bar");
42272
82e273c4f2b3 8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents: 41641
diff changeset
   223
    }
82e273c4f2b3 8169519: JShell: Handle start-up failures and hangs gracefully
rfield
parents: 41641
diff changeset
   224
38613
2a8e50869b08 8157953: JShell tests: reenable ToolBasicTest
rfield
parents: 38608
diff changeset
   225
    public void testStartupUnknown() throws Exception {
40588
b5c32bfa9710 8160089: jshell tool: use new double-dash long-form command-line options
rfield
parents: 38613
diff changeset
   226
        start("", "File 'UNKNOWN' for '--startup' is not found.", "--startup", "UNKNOWN");
42972
47ca49eee534 8172102: jshell tool: remove print method forwarding to System.out from default startup
rfield
parents: 42843
diff changeset
   227
        start("", "File 'UNKNOWN' for '--startup' is not found.", "--startup", "DEFAULT", "--startup", "UNKNOWN");
33362
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
   228
    }
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
   229
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
   230
    public void testClasspath() throws Exception {
40588
b5c32bfa9710 8160089: jshell tool: use new double-dash long-form command-line options
rfield
parents: 38613
diff changeset
   231
        for (String cp : new String[] {"--class-path"}) {
b5c32bfa9710 8160089: jshell tool: use new double-dash long-form command-line options
rfield
parents: 38613
diff changeset
   232
            start("", "Only one --class-path option may be used.", cp, ".", "--class-path", ".");
b5c32bfa9710 8160089: jshell tool: use new double-dash long-form command-line options
rfield
parents: 38613
diff changeset
   233
            start("", "Argument to class-path missing.", cp);
33362
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
   234
        }
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
   235
    }
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
   236
44683
610dc2b48954 8178023: jshell tool: crash with ugly message on attempt to add non-existant module path
rfield
parents: 43367
diff changeset
   237
    public void testUnknownModule() throws Exception {
610dc2b48954 8178023: jshell tool: crash with ugly message on attempt to add non-existant module path
rfield
parents: 43367
diff changeset
   238
        start(
610dc2b48954 8178023: jshell tool: crash with ugly message on attempt to add non-existant module path
rfield
parents: 43367
diff changeset
   239
                s -> assertEquals(s.trim(), "", "cmdout: "),
610dc2b48954 8178023: jshell tool: crash with ugly message on attempt to add non-existant module path
rfield
parents: 43367
diff changeset
   240
                s -> assertEquals(s.trim(), "", "userout: "),
610dc2b48954 8178023: jshell tool: crash with ugly message on attempt to add non-existant module path
rfield
parents: 43367
diff changeset
   241
                s -> assertTrue(s.contains("rror") && s.contains("unKnown"), "cmderr: " + s),
610dc2b48954 8178023: jshell tool: crash with ugly message on attempt to add non-existant module path
rfield
parents: 43367
diff changeset
   242
                "--add-modules", "unKnown");
610dc2b48954 8178023: jshell tool: crash with ugly message on attempt to add non-existant module path
rfield
parents: 43367
diff changeset
   243
    }
610dc2b48954 8178023: jshell tool: crash with ugly message on attempt to add non-existant module path
rfield
parents: 43367
diff changeset
   244
40588
b5c32bfa9710 8160089: jshell tool: use new double-dash long-form command-line options
rfield
parents: 38613
diff changeset
   245
    public void testFeedbackOptionConflict() throws Exception {
b5c32bfa9710 8160089: jshell tool: use new double-dash long-form command-line options
rfield
parents: 38613
diff changeset
   246
        start("", "Only one feedback option (--feedback, -q, -s, or -v) may be used.",
b5c32bfa9710 8160089: jshell tool: use new double-dash long-form command-line options
rfield
parents: 38613
diff changeset
   247
                "--feedback", "concise", "--feedback", "verbose");
b5c32bfa9710 8160089: jshell tool: use new double-dash long-form command-line options
rfield
parents: 38613
diff changeset
   248
        start("", "Only one feedback option (--feedback, -q, -s, or -v) may be used.", "--feedback", "concise", "-s");
b5c32bfa9710 8160089: jshell tool: use new double-dash long-form command-line options
rfield
parents: 38613
diff changeset
   249
        start("", "Only one feedback option (--feedback, -q, -s, or -v) may be used.", "--feedback", "verbose", "-q");
b5c32bfa9710 8160089: jshell tool: use new double-dash long-form command-line options
rfield
parents: 38613
diff changeset
   250
        start("", "Only one feedback option (--feedback, -q, -s, or -v) may be used.", "--feedback", "concise", "-v");
b5c32bfa9710 8160089: jshell tool: use new double-dash long-form command-line options
rfield
parents: 38613
diff changeset
   251
        start("", "Only one feedback option (--feedback, -q, -s, or -v) may be used.", "-v", "--feedback", "concise");
b5c32bfa9710 8160089: jshell tool: use new double-dash long-form command-line options
rfield
parents: 38613
diff changeset
   252
        start("", "Only one feedback option (--feedback, -q, -s, or -v) may be used.", "-q", "-v");
b5c32bfa9710 8160089: jshell tool: use new double-dash long-form command-line options
rfield
parents: 38613
diff changeset
   253
        start("", "Only one feedback option (--feedback, -q, -s, or -v) may be used.", "-s", "-v");
b5c32bfa9710 8160089: jshell tool: use new double-dash long-form command-line options
rfield
parents: 38613
diff changeset
   254
        start("", "Only one feedback option (--feedback, -q, -s, or -v) may be used.", "-v", "-q");
b5c32bfa9710 8160089: jshell tool: use new double-dash long-form command-line options
rfield
parents: 38613
diff changeset
   255
        start("", "Only one feedback option (--feedback, -q, -s, or -v) may be used.", "-q", "-s");
b5c32bfa9710 8160089: jshell tool: use new double-dash long-form command-line options
rfield
parents: 38613
diff changeset
   256
    }
b5c32bfa9710 8160089: jshell tool: use new double-dash long-form command-line options
rfield
parents: 38613
diff changeset
   257
37745
4b6b59f8e327 8150382: JShell API: Allow setting remote JVM arguments
rfield
parents: 36993
diff changeset
   258
    public void testNegFeedbackOption() throws Exception {
40588
b5c32bfa9710 8160089: jshell tool: use new double-dash long-form command-line options
rfield
parents: 38613
diff changeset
   259
        start("", "Argument to feedback missing.", "--feedback");
b5c32bfa9710 8160089: jshell tool: use new double-dash long-form command-line options
rfield
parents: 38613
diff changeset
   260
        start("", "Does not match any current feedback mode: blorp -- --feedback blorp", "--feedback", "blorp");
37745
4b6b59f8e327 8150382: JShell API: Allow setting remote JVM arguments
rfield
parents: 36993
diff changeset
   261
    }
4b6b59f8e327 8150382: JShell API: Allow setting remote JVM arguments
rfield
parents: 36993
diff changeset
   262
33362
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
   263
    public void testVersion() throws Exception {
43367
7797472a9ed5 8171343: jshell tool: missing options: --help-extra --show-version
rfield
parents: 42972
diff changeset
   264
        start(
7797472a9ed5 8171343: jshell tool: missing options: --help-extra --show-version
rfield
parents: 42972
diff changeset
   265
                s -> {
7797472a9ed5 8171343: jshell tool: missing options: --help-extra --show-version
rfield
parents: 42972
diff changeset
   266
                    assertTrue(s.startsWith("jshell"), "unexpected version: " + s);
7797472a9ed5 8171343: jshell tool: missing options: --help-extra --show-version
rfield
parents: 42972
diff changeset
   267
                    assertFalse(s.contains("Welcome"), "Unexpected start: " + s);
7797472a9ed5 8171343: jshell tool: missing options: --help-extra --show-version
rfield
parents: 42972
diff changeset
   268
                },
7797472a9ed5 8171343: jshell tool: missing options: --help-extra --show-version
rfield
parents: 42972
diff changeset
   269
                null, null,
7797472a9ed5 8171343: jshell tool: missing options: --help-extra --show-version
rfield
parents: 42972
diff changeset
   270
                "--version");
7797472a9ed5 8171343: jshell tool: missing options: --help-extra --show-version
rfield
parents: 42972
diff changeset
   271
    }
7797472a9ed5 8171343: jshell tool: missing options: --help-extra --show-version
rfield
parents: 42972
diff changeset
   272
7797472a9ed5 8171343: jshell tool: missing options: --help-extra --show-version
rfield
parents: 42972
diff changeset
   273
    public void testShowVersion() throws Exception {
7797472a9ed5 8171343: jshell tool: missing options: --help-extra --show-version
rfield
parents: 42972
diff changeset
   274
        runShell("--show-version");
7797472a9ed5 8171343: jshell tool: missing options: --help-extra --show-version
rfield
parents: 42972
diff changeset
   275
        check(cmdout,
7797472a9ed5 8171343: jshell tool: missing options: --help-extra --show-version
rfield
parents: 42972
diff changeset
   276
                s -> {
7797472a9ed5 8171343: jshell tool: missing options: --help-extra --show-version
rfield
parents: 42972
diff changeset
   277
                    assertTrue(s.startsWith("jshell"), "unexpected version: " + s);
7797472a9ed5 8171343: jshell tool: missing options: --help-extra --show-version
rfield
parents: 42972
diff changeset
   278
                    assertTrue(s.contains("Welcome"), "Expected start (but got no welcome): " + s);
7797472a9ed5 8171343: jshell tool: missing options: --help-extra --show-version
rfield
parents: 42972
diff changeset
   279
                },
7797472a9ed5 8171343: jshell tool: missing options: --help-extra --show-version
rfield
parents: 42972
diff changeset
   280
                "cmdout");
7797472a9ed5 8171343: jshell tool: missing options: --help-extra --show-version
rfield
parents: 42972
diff changeset
   281
        check(cmderr, null, "cmderr");
7797472a9ed5 8171343: jshell tool: missing options: --help-extra --show-version
rfield
parents: 42972
diff changeset
   282
        check(console,
7797472a9ed5 8171343: jshell tool: missing options: --help-extra --show-version
rfield
parents: 42972
diff changeset
   283
                s -> assertTrue(s.trim().startsWith("jshell>"), "Expected prompt, got: " + s),
7797472a9ed5 8171343: jshell tool: missing options: --help-extra --show-version
rfield
parents: 42972
diff changeset
   284
                "console");
7797472a9ed5 8171343: jshell tool: missing options: --help-extra --show-version
rfield
parents: 42972
diff changeset
   285
        check(userout, null, "userout");
7797472a9ed5 8171343: jshell tool: missing options: --help-extra --show-version
rfield
parents: 42972
diff changeset
   286
        check(usererr, null, "usererr");
33362
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
   287
    }
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
   288
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
   289
    @AfterMethod
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
   290
    public void tearDown() {
38608
691b607bbcd6 8157917: JShell: shutdown could cause remote JDWP errors to be visible to users
rfield
parents: 37745
diff changeset
   291
        cmdout  = null;
691b607bbcd6 8157917: JShell: shutdown could cause remote JDWP errors to be visible to users
rfield
parents: 37745
diff changeset
   292
        cmderr  = null;
691b607bbcd6 8157917: JShell: shutdown could cause remote JDWP errors to be visible to users
rfield
parents: 37745
diff changeset
   293
        console = null;
691b607bbcd6 8157917: JShell: shutdown could cause remote JDWP errors to be visible to users
rfield
parents: 37745
diff changeset
   294
        userout = null;
691b607bbcd6 8157917: JShell: shutdown could cause remote JDWP errors to be visible to users
rfield
parents: 37745
diff changeset
   295
        usererr = null;
43367
7797472a9ed5 8171343: jshell tool: missing options: --help-extra --show-version
rfield
parents: 42972
diff changeset
   296
        cmdInStream = null;
33362
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
   297
    }
65ec6de1d6b4 8134254: JShell API/tool: REPL for Java into JDK9
jlahoda
parents:
diff changeset
   298
}