langtools/test/jdk/jshell/ToolFormatTest.java
author rfield
Mon, 23 May 2016 10:12:05 -0700
changeset 38539 71874886920f
parent 38531 c449daa25b45
child 38615 9221159d84fb
permissions -rw-r--r--
8157517: jshell tool: allow undoing operations 8157395: jshell tool: allow the position of options on commands to be more flexible 8157393: jshell tool: change /set newmode ... to be consistent with /retain mode Reviewed-by: jlahoda
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
38513
0ae85633d035 8154812: jshell tool: value printing truncation
rfield
parents: 37640
diff changeset
    26
 * @bug 8148316 8148317 8151755 8152246 8153551 8154812
36494
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
36778
e04318f39f92 8152897: refactor ToolBox to allow reduced documented dependencies
jjg
parents: 36718
diff changeset
    33
 * @build KullaTesting TestingInputStream toolbox.ToolBox Compiler
36494
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
 */
36718
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
    36
import java.util.ArrayList;
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
    37
import java.util.List;
36494
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    38
import org.testng.annotations.Test;
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    39
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    40
@Test
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    41
public class ToolFormatTest extends ReplToolTesting {
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    42
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    43
    public void testSetFormat() {
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    44
        try {
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    45
            test(
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents: 38531
diff changeset
    46
                    (a) -> assertCommandOutputStartsWith(a, "/set mode test -command", "|  Created new feedback mode: test"),
36718
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
    47
                    (a) -> assertCommand(a, "/set format test pre '$ '", ""),
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
    48
                    (a) -> assertCommand(a, "/set format test post ''", ""),
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
    49
                    (a) -> assertCommand(a, "/set format test act 'ADD' added", ""),
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
    50
                    (a) -> assertCommand(a, "/set format test act 'MOD' modified", ""),
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
    51
                    (a) -> assertCommand(a, "/set format test act 'REP' replaced", ""),
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
    52
                    (a) -> assertCommand(a, "/set format test act 'OVR' overwrote", ""),
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
    53
                    (a) -> assertCommand(a, "/set format test act 'USE' used", ""),
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
    54
                    (a) -> assertCommand(a, "/set format test act 'DRP' dropped", ""),
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
    55
                    (a) -> assertCommand(a, "/set format test up 'UP-' update", ""),
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
    56
                    (a) -> assertCommand(a, "/set format test action '{up}{act} '", ""),
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
    57
                    (a) -> assertCommand(a, "/set format test resolve 'OK' ok", ""),
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
    58
                    (a) -> assertCommand(a, "/set format test resolve 'DEF' defined", ""),
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
    59
                    (a) -> assertCommand(a, "/set format test resolve 'NODEF' notdefined", ""),
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
    60
                    (a) -> assertCommand(a, "/set format test fname ':{name} ' ", ""),
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
    61
                    (a) -> assertCommand(a, "/set format test ftype '[{type}]' method,expression", ""),
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
    62
                    (a) -> assertCommand(a, "/set format test result '={value} ' expression", ""),
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
    63
                    (a) -> assertCommand(a, "/set format test display '{pre}{action}{ftype}{fname}{result}{resolve}'", ""),
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
    64
                    (a) -> assertCommand(a, "/set format test display '{pre}HI this is enum' enum", ""),
36990
ec0b843a7af5 8147515: JShell: Internationalize
rfield
parents: 36778
diff changeset
    65
                    (a) -> assertCommandOutputStartsWith(a, "/set feedback test", "$ Feedback mode: test"),
36494
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    66
                    (a) -> assertCommand(a, "class D {}", "$ ADD :D OK"),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    67
                    (a) -> assertCommand(a, "void m() {}", "$ ADD []:m OK"),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    68
                    (a) -> assertCommand(a, "interface EX extends EEX {}", "$ ADD :EX NODEF"),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    69
                    (a) -> assertCommand(a, "56", "$ ADD [int]:$4 =56 OK"),
36718
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
    70
                    (a) -> assertCommand(a, "class D { int hh; }", "$ REP :D OK$ UP-OVR :D OK"),
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
    71
                    (a) -> assertCommand(a, "enum E {A,B}", "$ HI this is enum"),
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
    72
                    (a) -> assertCommand(a, "int z() { return f(); }", "$ ADD []:z DEF"),
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
    73
                    (a) -> assertCommand(a, "z()", "$ UP-USE []:z DEF"),
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
    74
                    (a) -> assertCommand(a, "/drop z", "$ DRP []:z OK"),
36494
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    75
                    (a) -> assertCommandOutputStartsWith(a, "/set feedback normal", "|  Feedback mode: normal")
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    76
            );
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    77
        } finally {
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    78
            assertCommandCheckOutput(false, "/set feedback normal", s -> {
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    79
            });
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    80
        }
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    81
    }
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
    82
36718
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
    83
    public void testSetFormatSelector() {
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
    84
        List<ReplTest> tests = new ArrayList<>();
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents: 38531
diff changeset
    85
        tests.add((a) -> assertCommandOutputStartsWith(a, "/set mode ate -quiet",
36718
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
    86
                            "|  Created new feedback mode: ate"));
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
    87
        tests.add((a) -> assertCommand(a, "/set feedback ate", ""));
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
    88
        StringBuilder sb = new StringBuilder();
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
    89
        class KindList {
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
    90
            final String[] values;
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
    91
            final int matchIndex;
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
    92
            int current;
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
    93
            boolean match;
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
    94
            KindList(String[] values, int matchIndex) {
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
    95
                this.values = values;
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
    96
                this.matchIndex = matchIndex;
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
    97
                this.current = 1 << values.length;
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
    98
            }
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
    99
            boolean next() {
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   100
                if (current <= 0) {
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   101
                    return false;
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   102
                }
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   103
                --current;
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   104
                return true;
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   105
            }
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   106
            boolean append(boolean ahead) {
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   107
                boolean any = false;
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   108
                match = false;
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   109
                for (int i = values.length - 1; i >= 0 ; --i) {
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   110
                    if ((current & (1 << i)) != 0) {
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   111
                        match |= i == matchIndex;
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   112
                        if (any) {
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   113
                            sb.append(",");
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   114
                        } else {
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   115
                            if (ahead) {
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   116
                                sb.append("-");
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   117
                            }
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   118
                        }
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   119
                        sb.append(values[i]);
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   120
                        any = true;
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   121
                    }
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   122
                }
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   123
                match |= !any;
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   124
                return ahead || any;
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   125
            }
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   126
        }
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   127
        KindList klcase = new KindList(new String[] {"class", "method", "expression", "vardecl"}, 2);
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   128
        while (klcase.next()) {
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   129
            KindList klact  = new KindList(new String[] {"added", "modified", "replaced"}, 0);
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   130
            while (klact.next()) {
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   131
                KindList klwhen = new KindList(new String[] {"update", "primary"}, 1);
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   132
                while (klwhen.next()) {
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   133
                    sb.setLength(0);
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   134
                    klwhen.append(
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   135
                        klact.append(
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   136
                            klcase.append(false)));
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   137
                    boolean match = klcase.match && klact.match && klwhen.match;
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   138
                    String select = sb.toString();
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   139
                    String yes = "+++" + select + "+++";
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   140
                    String no  = "---" + select + "---";
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   141
                    String expect = match? yes : no;
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   142
                    tests.add((a) -> assertCommand(a, "/set format ate display '" + no  + "'", ""));
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   143
                    tests.add((a) -> assertCommand(a, "/set format ate display '" + yes + "' " + select, ""));
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   144
                    tests.add((a) -> assertCommand(a, "\"" + select + "\"", expect));
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   145
                }
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   146
            }
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   147
        }
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   148
        tests.add((a) -> assertCommandOutputStartsWith(a, "/set feedback normal", "|  Feedback mode: normal"));
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   149
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   150
        try {
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   151
            test(tests.toArray(new ReplTest[tests.size()]));
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   152
        } finally {
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   153
            assertCommandCheckOutput(false, "/set feedback normal", s -> {
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   154
            });
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   155
        }
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   156
    }
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   157
38513
0ae85633d035 8154812: jshell tool: value printing truncation
rfield
parents: 37640
diff changeset
   158
    public void testSetTruncation() {
0ae85633d035 8154812: jshell tool: value printing truncation
rfield
parents: 37640
diff changeset
   159
        try {
0ae85633d035 8154812: jshell tool: value printing truncation
rfield
parents: 37640
diff changeset
   160
            test(
0ae85633d035 8154812: jshell tool: value printing truncation
rfield
parents: 37640
diff changeset
   161
                    (a) -> assertCommandOutputStartsWith(a, "/set feedback normal", ""),
0ae85633d035 8154812: jshell tool: value printing truncation
rfield
parents: 37640
diff changeset
   162
                    (a) -> assertCommand(a, "String s = java.util.stream.IntStream.range(65, 74)"+
0ae85633d035 8154812: jshell tool: value printing truncation
rfield
parents: 37640
diff changeset
   163
                            ".mapToObj(i -> \"\"+(char)i).reduce((a,b) -> a + b + a).get()",
0ae85633d035 8154812: jshell tool: value printing truncation
rfield
parents: 37640
diff changeset
   164
                            "s ==> \"ABACABADABACABAEABACABADABACABAFABACABADABACABAEABACABADABACABAGABACABADABA ..."),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents: 38531
diff changeset
   165
                    (a) -> assertCommandOutputStartsWith(a, "/set mode test -quiet", ""),
38513
0ae85633d035 8154812: jshell tool: value printing truncation
rfield
parents: 37640
diff changeset
   166
                    (a) -> assertCommandOutputStartsWith(a, "/set feedback test", ""),
0ae85633d035 8154812: jshell tool: value printing truncation
rfield
parents: 37640
diff changeset
   167
                    (a) -> assertCommand(a, "/set format test display '{type}:{value}' primary", ""),
0ae85633d035 8154812: jshell tool: value printing truncation
rfield
parents: 37640
diff changeset
   168
                    (a) -> assertCommand(a, "/set truncation test 20", ""),
0ae85633d035 8154812: jshell tool: value printing truncation
rfield
parents: 37640
diff changeset
   169
                    (a) -> assertCommand(a, "/set trunc test 10 varvalue", ""),
0ae85633d035 8154812: jshell tool: value printing truncation
rfield
parents: 37640
diff changeset
   170
                    (a) -> assertCommand(a, "/set trunc test 3 assignment", ""),
0ae85633d035 8154812: jshell tool: value printing truncation
rfield
parents: 37640
diff changeset
   171
                    (a) -> assertCommand(a, "String r = s", "String:\"ABACABADABACABA ..."),
0ae85633d035 8154812: jshell tool: value printing truncation
rfield
parents: 37640
diff changeset
   172
                    (a) -> assertCommand(a, "r", "String:\"ABACA ..."),
0ae85633d035 8154812: jshell tool: value printing truncation
rfield
parents: 37640
diff changeset
   173
                    (a) -> assertCommand(a, "r=s", "String:\"AB")
0ae85633d035 8154812: jshell tool: value printing truncation
rfield
parents: 37640
diff changeset
   174
            );
0ae85633d035 8154812: jshell tool: value printing truncation
rfield
parents: 37640
diff changeset
   175
        } finally {
0ae85633d035 8154812: jshell tool: value printing truncation
rfield
parents: 37640
diff changeset
   176
            assertCommandCheckOutput(false, "/set feedback normal", s -> {
0ae85633d035 8154812: jshell tool: value printing truncation
rfield
parents: 37640
diff changeset
   177
            });
0ae85633d035 8154812: jshell tool: value printing truncation
rfield
parents: 37640
diff changeset
   178
        }
0ae85633d035 8154812: jshell tool: value printing truncation
rfield
parents: 37640
diff changeset
   179
    }
0ae85633d035 8154812: jshell tool: value printing truncation
rfield
parents: 37640
diff changeset
   180
37640
42e5136a367c 8153551: jshell tool: no longer a mechanism to see current feedback modes
rfield
parents: 36990
diff changeset
   181
    public void testShowFeedbackModes() {
42e5136a367c 8153551: jshell tool: no longer a mechanism to see current feedback modes
rfield
parents: 36990
diff changeset
   182
        test(
42e5136a367c 8153551: jshell tool: no longer a mechanism to see current feedback modes
rfield
parents: 36990
diff changeset
   183
                (a) -> assertCommandOutputContains(a, "/set feedback", "normal")
42e5136a367c 8153551: jshell tool: no longer a mechanism to see current feedback modes
rfield
parents: 36990
diff changeset
   184
        );
42e5136a367c 8153551: jshell tool: no longer a mechanism to see current feedback modes
rfield
parents: 36990
diff changeset
   185
    }
42e5136a367c 8153551: jshell tool: no longer a mechanism to see current feedback modes
rfield
parents: 36990
diff changeset
   186
36718
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   187
    public void testSetNewModeQuiet() {
36494
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   188
        try {
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   189
            test(
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents: 38531
diff changeset
   190
                    (a) -> assertCommandOutputStartsWith(a, "/set mode nmq -quiet normal", "|  Created new feedback mode: nmq"),
36494
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   191
                    (a) -> assertCommand(a, "/set feedback nmq", ""),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents: 38531
diff changeset
   192
                    (a) -> assertCommand(a, "/se mo nmq2 -q nor", ""),
36494
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   193
                    (a) -> assertCommand(a, "/se fee nmq2", ""),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents: 38531
diff changeset
   194
                    (a) -> assertCommand(a, "/set mode nmc -command normal", ""),
36494
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   195
                    (a) -> assertCommandOutputStartsWith(a, "/set feedback nmc", "|  Feedback mode: nmc"),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents: 38531
diff changeset
   196
                    (a) -> assertCommandOutputStartsWith(a, "/set mode nm", "|  Created new feedback mode: nm"),
36718
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   197
                    (a) -> assertCommandOutputStartsWith(a, "/set feedback nm", "|  Feedback mode: nm"),
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   198
                    (a) -> assertCommandOutputStartsWith(a, "/set feedback normal", "|  Feedback mode: normal")
36494
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   199
            );
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   200
        } finally {
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   201
            assertCommandCheckOutput(false, "/set feedback normal", s -> {
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   202
            });
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   203
        }
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   204
    }
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   205
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   206
    public void testSetError() {
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   207
        try {
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   208
            test(
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents: 38531
diff changeset
   209
                    (a) -> assertCommandOutputStartsWith(a, "/set mode tee -command foo",
36718
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   210
                            "|  Does not match any current feedback mode: foo"),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents: 38531
diff changeset
   211
                    (a) -> assertCommandOutputStartsWith(a, "/set mode tee flurb",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents: 38531
diff changeset
   212
                            "|  Does not match any current feedback mode: flurb"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents: 38531
diff changeset
   213
                    (a) -> assertCommandOutputStartsWith(a, "/set mode tee",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents: 38531
diff changeset
   214
                            "|  Created new feedback mode: tee"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents: 38531
diff changeset
   215
                    (a) -> assertCommandOutputStartsWith(a, "/set mode verbose",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents: 38531
diff changeset
   216
                            "|  Not valid with a predefined mode: verbose"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents: 38531
diff changeset
   217
                    (a) -> assertCommandOutputStartsWith(a, "/set mode te -command normal",
36718
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   218
                            "|  Created new feedback mode: te"),
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   219
                    (a) -> assertCommand(a, "/set format te errorpre 'ERROR: '", ""),
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   220
                    (a) -> assertCommandOutputStartsWith(a, "/set feedback te",
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   221
                            ""),
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   222
                    (a) -> assertCommandOutputStartsWith(a, "/set ",
38531
c449daa25b45 8157200: jshell tool: Add /retain command to persist settings
rfield
parents: 38520
diff changeset
   223
                            "ERROR: The '/set' command requires a sub-command"),
36718
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   224
                    (a) -> assertCommandOutputStartsWith(a, "/set xyz",
36990
ec0b843a7af5 8147515: JShell: Internationalize
rfield
parents: 36778
diff changeset
   225
                            "ERROR: Invalid '/set' argument: xyz"),
36718
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   226
                    (a) -> assertCommandOutputStartsWith(a, "/set f",
36990
ec0b843a7af5 8147515: JShell: Internationalize
rfield
parents: 36778
diff changeset
   227
                            "ERROR: Ambiguous sub-command argument to '/set': f"),
36718
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   228
                    (a) -> assertCommandOutputStartsWith(a, "/set feedback",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents: 38531
diff changeset
   229
                            "ERROR: Missing the feedback mode"),
36718
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   230
                    (a) -> assertCommandOutputStartsWith(a, "/set feedback xyz",
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   231
                            "ERROR: Does not match any current feedback mode"),
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   232
                    (a) -> assertCommandOutputStartsWith(a, "/set format",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents: 38531
diff changeset
   233
                            "ERROR: Missing the feedback mode"),
36718
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   234
                    (a) -> assertCommandOutputStartsWith(a, "/set format xyz",
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   235
                            "ERROR: Does not match any current feedback mode"),
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   236
                    (a) -> assertCommandOutputStartsWith(a, "/set format t",
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   237
                            "ERROR: Matches more then one current feedback mode: t"),
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   238
                    (a) -> assertCommandOutputStartsWith(a, "/set format te",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents: 38531
diff changeset
   239
                            "ERROR: Missing the field name"),
36718
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   240
                    (a) -> assertCommandOutputStartsWith(a, "/set format te fld",
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   241
                            "ERROR: Expected format missing"),
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   242
                    (a) -> assertCommandOutputStartsWith(a, "/set format te fld aaa",
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   243
                            "ERROR: Format 'aaa' must be quoted"),
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   244
                    (a) -> assertCommandOutputStartsWith(a, "/set format te fld 'aaa' frog",
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   245
                            "ERROR: Not a valid selector"),
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   246
                    (a) -> assertCommandOutputStartsWith(a, "/set format te fld 'aaa' import-frog",
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   247
                            "ERROR: Not a valid selector"),
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   248
                    (a) -> assertCommandOutputStartsWith(a, "/set format te fld 'aaa' import-import",
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   249
                            "ERROR: Selector kind in multiple sections of"),
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   250
                    (a) -> assertCommandOutputStartsWith(a, "/set format te fld 'aaa' import,added",
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   251
                            "ERROR: Different selector kinds in same sections of"),
38513
0ae85633d035 8154812: jshell tool: value printing truncation
rfield
parents: 37640
diff changeset
   252
                    (a) -> assertCommandOutputStartsWith(a, "/set trunc te 20x",
0ae85633d035 8154812: jshell tool: value printing truncation
rfield
parents: 37640
diff changeset
   253
                            "ERROR: Truncation length must be an integer: 20x"),
0ae85633d035 8154812: jshell tool: value printing truncation
rfield
parents: 37640
diff changeset
   254
                    (a) -> assertCommandOutputStartsWith(a, "/set trunc te",
0ae85633d035 8154812: jshell tool: value printing truncation
rfield
parents: 37640
diff changeset
   255
                            "ERROR: Expected truncation length"),
0ae85633d035 8154812: jshell tool: value printing truncation
rfield
parents: 37640
diff changeset
   256
                    (a) -> assertCommandOutputStartsWith(a, "/set truncation te 111 import,added",
0ae85633d035 8154812: jshell tool: value printing truncation
rfield
parents: 37640
diff changeset
   257
                            "ERROR: Different selector kinds in same sections of"),
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents: 38531
diff changeset
   258
                    (a) -> assertCommandOutputStartsWith(a, "/set mode",
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents: 38531
diff changeset
   259
                            "ERROR: Missing the feedback mode"),
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents: 38531
diff changeset
   260
                    (a) -> assertCommandOutputStartsWith(a, "/set mode x -quiet y",
36718
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   261
                            "ERROR: Does not match any current feedback mode"),
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   262
                    (a) -> assertCommandOutputStartsWith(a, "/set prompt",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents: 38531
diff changeset
   263
                            "ERROR: Missing the feedback mode"),
36718
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   264
                    (a) -> assertCommandOutputStartsWith(a, "/set prompt te",
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   265
                            "ERROR: Expected format missing"),
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   266
                    (a) -> assertCommandOutputStartsWith(a, "/set prompt te aaa xyz",
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   267
                            "ERROR: Format 'aaa' must be quoted"),
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   268
                    (a) -> assertCommandOutputStartsWith(a, "/set prompt te 'aaa' xyz",
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   269
                            "ERROR: Format 'xyz' must be quoted"),
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   270
                    (a) -> assertCommandOutputStartsWith(a, "/set prompt",
38539
71874886920f 8157517: jshell tool: allow undoing operations
rfield
parents: 38531
diff changeset
   271
                            "ERROR: Missing the feedback mode"),
36718
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   272
                    (a) -> assertCommandOutputStartsWith(a, "/set prompt te",
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   273
                            "ERROR: Expected format missing"),
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   274
                    (a) -> assertCommandOutputStartsWith(a, "/set prompt te aaa",
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   275
                            "ERROR: Format 'aaa' must be quoted"),
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   276
                    (a) -> assertCommandOutputStartsWith(a, "/set prompt te 'aaa'",
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   277
                            "ERROR: Expected format missing"),
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   278
                    (a) -> assertCommandOutputStartsWith(a, "/set feedback normal",
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   279
                            "|  Feedback mode: normal")
36494
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   280
            );
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   281
        } finally {
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   282
            assertCommandCheckOutput(false, "/set feedback normal", s -> {
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   283
            });
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   284
        }
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   285
    }
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   286
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   287
    public void testSetHelp() {
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   288
        try {
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   289
            test(
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   290
                    (a) -> assertCommandOutputContains(a, "/help /set", "command to launch"),
36718
bf40906bf49d 8151755: jshell tool: properly cover resolution issues in output configuration
rfield
parents: 36526
diff changeset
   291
                    (a) -> assertCommandOutputContains(a, "/help /set format", "display"),
36494
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   292
                    (a) -> assertCommandOutputContains(a, "/hel /se for", "vardecl"),
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   293
                    (a) -> assertCommandOutputContains(a, "/help /set editor", "temporary file")
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   294
            );
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   295
        } finally {
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   296
            assertCommandCheckOutput(false, "/set feedback normal", s -> {
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   297
            });
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   298
        }
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   299
    }
4175f47b2a50 8148316: jshell tool: Configurable output format
rfield
parents:
diff changeset
   300
}