langtools/test/jdk/jshell/ToolFormatTest.java
author alanb
Thu, 17 Mar 2016 19:04:28 +0000
changeset 36526 3b41f1c69604
parent 36494 4175f47b2a50
child 36718 bf40906bf49d
permissions -rw-r--r--
8142968: Module System implementation Summary: Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282 Reviewed-by: jjg, jlahoda, vromero, mcimadamore, bpatel, ksrini, darcy, anazarov, dfuchs Contributed-by: alan.bateman@oracle.com, alex.buckley@oracle.com, jonathan.gibbons@oracle.com, karen.kinnear@oracle.com, mandy.chung@oracle.com, mark.reinhold@oracle.com, jan.lahoda@oracle.com, vicente.romero@oracle.com, andreas.lundblad@oracle.com, andrey.x.nazarov@oracle.com, chris.hegarty@oracle.com, erik.joelsson@oracle.com, kumar.x.srinivasan@oracle.com, sundararajan.athijegannathan@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
36494
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
     1
/*
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
     2
 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
     4
 *
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
     7
 * published by the Free Software Foundation.
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
     8
 *
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    13
 * accompanied this code).
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    14
 *
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    18
 *
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    21
 * questions.
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    22
 */
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    23
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    24
/*
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    25
 * @test
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    26
 * @bug 8148316 8148317
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    27
 * @summary Tests for output customization
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    28
 * @library /tools/lib
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36494
diff changeset
    29
 * @modules jdk.compiler/com.sun.tools.javac.api
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36494
diff changeset
    30
 *          jdk.compiler/com.sun.tools.javac.main
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36494
diff changeset
    31
 *          jdk.jdeps/com.sun.tools.javap
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36494
diff changeset
    32
 *          jdk.jshell/jdk.internal.jshell.tool
36494
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    33
 * @build KullaTesting TestingInputStream ToolBox Compiler
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    34
 * @run testng ToolFormatTest
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    35
 */
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    36
import org.testng.annotations.Test;
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    37
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    38
@Test
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    39
public class ToolFormatTest extends ReplToolTesting {
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    40
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    41
    public void testSetFormat() {
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    42
        try {
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    43
            test(
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    44
                    (a) -> assertCommandOutputStartsWith(a, "/set newmode test command", "|  Created new feedback mode: test"),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    45
                    (a) -> assertCommand(a, "/set field test pre '$ '", ""),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    46
                    (a) -> assertCommand(a, "/set field test post ''", ""),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    47
                    (a) -> assertCommand(a, "/set field test action 'ADD ' added-primary", ""),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    48
                    (a) -> assertCommand(a, "/set field test action 'MOD ' modified-primary", ""),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    49
                    (a) -> assertCommand(a, "/set field test action 'REP ' replaced-primary", ""),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    50
                    (a) -> assertCommand(a, "/set field test action 'UP-ADD ' added-update", ""),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    51
                    (a) -> assertCommand(a, "/set field test action 'UP-MOD ' modified-update", ""),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    52
                    (a) -> assertCommand(a, "/set field test action 'UP-REP ' replaced-update", ""),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    53
                    (a) -> assertCommand(a, "/set field test resolve 'OK' ok-*", ""),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    54
                    (a) -> assertCommand(a, "/set field test resolve 'DEF' defined-*", ""),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    55
                    (a) -> assertCommand(a, "/set field test resolve 'NODEF' notdefined-*", ""),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    56
                    (a) -> assertCommand(a, "/set field test name ':%s ' ", ""),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    57
                    (a) -> assertCommand(a, "/set field test type '[%s]' ", ""),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    58
                    (a) -> assertCommand(a, "/set field test result '=%s ' ", ""),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    59
                    (a) -> assertCommand(a, "/set format test '{pre}{action}{type}{name}{result}{resolve}' *-*-*", ""),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    60
                    (a) -> assertCommand(a, "/set format test '{pre}HI this is enum' enum", ""),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    61
                    (a) -> assertCommand(a, "/set feedback test", "$ Feedback mode: test"),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    62
                    (a) -> assertCommand(a, "class D {}", "$ ADD :D OK"),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    63
                    (a) -> assertCommand(a, "void m() {}", "$ ADD []:m OK"),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    64
                    (a) -> assertCommand(a, "interface EX extends EEX {}", "$ ADD :EX NODEF"),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    65
                    (a) -> assertCommand(a, "56", "$ ADD [int]:$4 =56 OK"),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    66
                    (a) -> assertCommand(a, "class D { int hh; }", "$ REP :D OK$ OVERWROTE-UPDATE:D OK"),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    67
                    (a) -> assertCommandOutputStartsWith(a, "/set feedback normal", "|  Feedback mode: normal")
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    68
            );
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    69
        } finally {
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    70
            assertCommandCheckOutput(false, "/set feedback normal", s -> {
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    71
            });
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    72
        }
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    73
    }
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    74
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    75
    public void testNewModeQuiet() {
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    76
        try {
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    77
            test(
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    78
                    (a) -> assertCommandOutputStartsWith(a, "/set newmode nmq quiet normal", "|  Created new feedback mode: nmq"),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    79
                    (a) -> assertCommand(a, "/set feedback nmq", ""),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    80
                    (a) -> assertCommand(a, "/se ne nmq2 q nor", ""),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    81
                    (a) -> assertCommand(a, "/se fee nmq2", ""),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    82
                    (a) -> assertCommand(a, "/set newmode nmc command normal", ""),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    83
                    (a) -> assertCommandOutputStartsWith(a, "/set feedback nmc", "|  Feedback mode: nmc"),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    84
                    (a) -> assertCommandOutputStartsWith(a, "/set newmode nm", "|  Created new feedback mode: nm"),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    85
                    (a) -> assertCommandOutputStartsWith(a, "/set feedback nm", "|  Feedback mode: nm")
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    86
            );
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    87
        } finally {
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    88
            assertCommandCheckOutput(false, "/set feedback normal", s -> {
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    89
            });
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    90
        }
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    91
    }
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    92
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    93
    public void testSetError() {
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    94
        try {
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    95
            test(
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    96
                    (a) -> assertCommandOutputStartsWith(a, "/set newmode te command normal", "|  Created new feedback mode: te"),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    97
                    (a) -> assertCommand(a, "/set field te errorpre 'ERROR: '", ""),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    98
                    (a) -> assertCommandOutputStartsWith(a, "/set feedback te", ""),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    99
                    (a) -> assertCommandCheckOutput(a, "/set ", assertStartsWith("ERROR: The /set command requires arguments")),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   100
                    (a) -> assertCommandCheckOutput(a, "/set xyz", assertStartsWith("ERROR: Not a valid argument to /set")),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   101
                    (a) -> assertCommandCheckOutput(a, "/set f", assertStartsWith("ERROR: Ambiguous argument to /set")),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   102
                    (a) -> assertCommandCheckOutput(a, "/set feedback", assertStartsWith("ERROR: Expected a feedback mode")),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   103
                    (a) -> assertCommandCheckOutput(a, "/set feedback xyz", assertStartsWith("ERROR: Does not match any current feedback mode")),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   104
                    (a) -> assertCommandCheckOutput(a, "/set format", assertStartsWith("ERROR: Expected a feedback mode")),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   105
                    (a) -> assertCommandCheckOutput(a, "/set format xyz", assertStartsWith("ERROR: Does not match any current feedback mode")),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   106
                    (a) -> assertCommandCheckOutput(a, "/set format te", assertStartsWith("ERROR: Expected format missing")),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   107
                    (a) -> assertCommandCheckOutput(a, "/set format te aaa", assertStartsWith("ERROR: Format 'aaa' must be quoted")),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   108
                    (a) -> assertCommandCheckOutput(a, "/set format te 'aaa'", assertStartsWith("ERROR: At least one selector required")),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   109
                    (a) -> assertCommandCheckOutput(a, "/set format te 'aaa' frog", assertStartsWith("ERROR: Not a valid case")),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   110
                    (a) -> assertCommandCheckOutput(a, "/set format te 'aaa' import-frog", assertStartsWith("ERROR: Not a valid action")),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   111
                    (a) -> assertCommandCheckOutput(a, "/set newmode", assertStartsWith("ERROR: Expected new feedback mode")),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   112
                    (a) -> assertCommandCheckOutput(a, "/set newmode te", assertStartsWith("ERROR: Expected a new feedback mode name")),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   113
                    (a) -> assertCommandCheckOutput(a, "/set newmode x xyz", assertStartsWith("ERROR: Specify either 'command' or 'quiet'")),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   114
                    (a) -> assertCommandCheckOutput(a, "/set newmode x quiet y", assertStartsWith("ERROR: Does not match any current feedback mode")),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   115
                    (a) -> assertCommandCheckOutput(a, "/set prompt", assertStartsWith("ERROR: Expected a feedback mode")),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   116
                    (a) -> assertCommandCheckOutput(a, "/set prompt te", assertStartsWith("ERROR: Expected format missing")),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   117
                    (a) -> assertCommandCheckOutput(a, "/set prompt te aaa xyz", assertStartsWith("ERROR: Format 'aaa' must be quoted")),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   118
                    (a) -> assertCommandCheckOutput(a, "/set prompt te 'aaa' xyz", assertStartsWith("ERROR: Format 'xyz' must be quoted")),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   119
                    (a) -> assertCommandCheckOutput(a, "/set prompt", assertStartsWith("ERROR: Expected a feedback mode")),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   120
                    (a) -> assertCommandCheckOutput(a, "/set prompt te", assertStartsWith("ERROR: Expected format missing")),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   121
                    (a) -> assertCommandCheckOutput(a, "/set prompt te aaa", assertStartsWith("ERROR: Format 'aaa' must be quoted")),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   122
                    (a) -> assertCommandCheckOutput(a, "/set prompt te 'aaa'", assertStartsWith("ERROR: Expected format missing")),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   123
                    (a) -> assertCommandCheckOutput(a, "/set field", assertStartsWith("ERROR: Expected a feedback mode")),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   124
                    (a) -> assertCommandCheckOutput(a, "/set field xyz", assertStartsWith("ERROR: Does not match any current feedback mode: xyz")),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   125
                    (a) -> assertCommandCheckOutput(a, "/set field te xyz", assertStartsWith("ERROR: Not a valid field: xyz, must be one of: when")),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   126
                    (a) -> assertCommandCheckOutput(a, "/set field te action", assertStartsWith("ERROR: Expected format missing")),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   127
                    (a) -> assertCommandCheckOutput(a, "/set field te action 'act'", assertStartsWith("ERROR: At least one selector required"))
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   128
            );
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   129
        } finally {
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   130
            assertCommandCheckOutput(false, "/set feedback normal", s -> {
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   131
            });
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   132
        }
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   133
    }
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   134
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   135
    public void testSetHelp() {
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   136
        try {
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   137
            test(
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   138
                    (a) -> assertCommandOutputContains(a, "/help /set", "command to launch"),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   139
                    (a) -> assertCommandOutputContains(a, "/help /set format", "vardecl"),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   140
                    (a) -> assertCommandOutputContains(a, "/hel /se for", "vardecl"),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   141
                    (a) -> assertCommandOutputContains(a, "/help /set editor", "temporary file")
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   142
            );
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   143
        } finally {
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   144
            assertCommandCheckOutput(false, "/set feedback normal", s -> {
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   145
            });
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   146
        }
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   147
    }
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   148
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   149
    public void testSetHelpError() {
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   150
        try {
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   151
            test(
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   152
                    (a) -> assertCommandOutputStartsWith(a, "/set newmode te command normal", "|  Created new feedback mode: te"),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   153
                    (a) -> assertCommand(a, "/set field te errorpre 'ERROR: '", ""),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   154
                    (a) -> assertCommandOutputStartsWith(a, "/set feedback te", "|  Feedback mode: te"),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   155
                    (a) -> assertCommandOutputContains(a, "/help /set xyz", "ERROR: Not a valid argument to /set: xyz"),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   156
                    (a) -> assertCommandOutputContains(a, "/help /set f", "ERROR: Ambiguous argument to /set: f")
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   157
            );
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   158
        } finally {
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   159
            assertCommandCheckOutput(false, "/set feedback normal", s -> {
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   160
            });
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   161
        }
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   162
    }
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   163
}