Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/langtools/jdk/jshell/IndentUITest.java
40930 views
1
/*
2
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*/
23
24
/**
25
* @test
26
* @bug 8241950 8247932
27
* @summary Check the UI behavior of indentation
28
* @library /tools/lib
29
* @modules
30
* jdk.compiler/com.sun.tools.javac.api
31
* jdk.compiler/com.sun.tools.javac.main
32
* jdk.jshell/jdk.internal.jshell.tool:open
33
* jdk.jshell/jdk.internal.jshell.tool.resources:open
34
* jdk.jshell/jdk.jshell:open
35
* @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask
36
* @build Compiler UITesting
37
* @compile IndentUITest.java
38
* @run testng IndentUITest
39
*/
40
41
import org.testng.annotations.Test;
42
43
@Test
44
public class IndentUITest extends UITesting {
45
46
public IndentUITest() {
47
super(true);
48
}
49
50
public void testIdent() throws Exception {
51
doRunTest((inputSink, out) -> {
52
inputSink.write("void test1() {\nSystem.err.println(1);\n}\n");
53
waitOutput(out, "void test1\\(\\)\u001B\\[2D\u001B\\[2C \\{\n" +
54
CONTINUATION_PROMPT + " System.err.println\\(1\\)\u001B\\[3D\u001B\\[3C;\n" +
55
CONTINUATION_PROMPT + " \\}\u001B\\[2A\u001B\\[8C\n\n\u001B\\[K\\}\n" +
56
"\u001B\\[\\?2004l\\| created method test1\\(\\)\n" +
57
"\u001B\\[\\?2004h" + PROMPT);
58
inputSink.write(UP);
59
waitOutput(out, "^void test1\\(\\) \\{\n" +
60
CONTINUATION_PROMPT + " System.err.println\\(1\\);\n" +
61
CONTINUATION_PROMPT + "\\}");
62
inputSink.write(DOWN);
63
inputSink.write("/set indent 2\n");
64
inputSink.write("void test2() {\nSystem.err.println(1);\n}\n");
65
waitOutput(out, "void test2\\(\\)\u001B\\[2D\u001B\\[2C \\{\n" +
66
CONTINUATION_PROMPT + " System.err.println\\(1\\)\u001B\\[3D\u001B\\[3C;\n" +
67
CONTINUATION_PROMPT + " \\}\u001B\\[2A\u001B\\[10C\n\n\u001B\\[K\\}\n" +
68
"\u001B\\[\\?2004l\\| created method test2\\(\\)\n" +
69
"\u001B\\[\\?2004h" + PROMPT);
70
inputSink.write(UP);
71
waitOutput(out, "^void test2\\(\\) \\{\n" +
72
CONTINUATION_PROMPT + " System.err.println\\(1\\);\n" +
73
CONTINUATION_PROMPT + "\\}");
74
inputSink.write(INTERRUPT);
75
waitOutput(out, "\u001B\\[\\?2004h" + PROMPT);
76
inputSink.write("\"\"\"\n");
77
waitOutput(out, "^\"\"\"\n" +
78
CONTINUATION_PROMPT);
79
});
80
}
81
82
}
83
84