test/langtools/jdk/jshell/ToolTabCommandTest.java

Print this page




   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 8177076
  27  * @modules
  28  *     jdk.compiler/com.sun.tools.javac.api
  29  *     jdk.compiler/com.sun.tools.javac.main
  30  *     jdk.jshell/jdk.internal.jshell.tool.resources:open
  31  *     jdk.jshell/jdk.jshell:open
  32  * @library /tools/lib
  33  * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask
  34  * @build Compiler UITesting
  35  * @build ToolTabCommandTest
  36  * @run testng ToolTabCommandTest
  37  */
  38 
  39 import java.util.regex.Pattern;
  40 
  41 import org.testng.annotations.Test;
  42 
  43 @Test
  44 public class ToolTabCommandTest extends UITesting {
  45 
  46     public void testCommand() throws Exception {


  90 
  91             inputSink.write("\011");
  92             waitOutput(out, Pattern.quote(getResource("help.env.summary")) + "\n\n" +
  93                             Pattern.quote(getResource("jshell.console.see.full.documentation")) + "\n" +
  94                             "\r\u0005/env -");
  95 
  96             inputSink.write("\011");
  97             waitOutput(out, Pattern.quote(getResource("help.env").replaceAll("\t", "    ")) + "\n" +
  98                             "\r\u0005/env -");
  99 
 100             inputSink.write("\011");
 101             waitOutput(out, "-add-exports    -add-modules    -class-path     -module-path    \n" +
 102                             "\n" +
 103                             Pattern.quote(getResource("jshell.console.see.synopsis")) + "\n" +
 104                             "\r\u0005/env -");
 105 
 106             inputSink.write("\u0003/exit \011");
 107             waitOutput(out, Pattern.quote(getResource("help.exit.summary")) + "\n\n" +
 108                             Pattern.quote(getResource("jshell.console.see.full.documentation")) + "\n\r\u0005/exit ");
 109             inputSink.write("\011");
 110             waitOutput(out, Pattern.quote(getResource("help.exit")) + "\n" +
 111                             "\r\u0005/exit ");
 112             inputSink.write("\011");
 113             waitOutput(out, Pattern.quote(getResource("help.exit.summary")) + "\n\n" +
 114                             Pattern.quote(getResource("jshell.console.see.full.documentation")) + "\n\r\u0005/exit ");





 115             inputSink.write("\u0003/doesnotexist\011");
 116             waitOutput(out, "\u0005/doesnotexist\n" +
 117                             Pattern.quote(getResource("jshell.console.no.such.command")) + "\n" +
 118                             "\n" +
 119                             "\r\u0005/doesnotexist");
 120         });
 121     }
 122 
 123 }


   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 8177076 8185840
  27  * @modules
  28  *     jdk.compiler/com.sun.tools.javac.api
  29  *     jdk.compiler/com.sun.tools.javac.main
  30  *     jdk.jshell/jdk.internal.jshell.tool.resources:open
  31  *     jdk.jshell/jdk.jshell:open
  32  * @library /tools/lib
  33  * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask
  34  * @build Compiler UITesting
  35  * @build ToolTabCommandTest
  36  * @run testng ToolTabCommandTest
  37  */
  38 
  39 import java.util.regex.Pattern;
  40 
  41 import org.testng.annotations.Test;
  42 
  43 @Test
  44 public class ToolTabCommandTest extends UITesting {
  45 
  46     public void testCommand() throws Exception {


  90 
  91             inputSink.write("\011");
  92             waitOutput(out, Pattern.quote(getResource("help.env.summary")) + "\n\n" +
  93                             Pattern.quote(getResource("jshell.console.see.full.documentation")) + "\n" +
  94                             "\r\u0005/env -");
  95 
  96             inputSink.write("\011");
  97             waitOutput(out, Pattern.quote(getResource("help.env").replaceAll("\t", "    ")) + "\n" +
  98                             "\r\u0005/env -");
  99 
 100             inputSink.write("\011");
 101             waitOutput(out, "-add-exports    -add-modules    -class-path     -module-path    \n" +
 102                             "\n" +
 103                             Pattern.quote(getResource("jshell.console.see.synopsis")) + "\n" +
 104                             "\r\u0005/env -");
 105 
 106             inputSink.write("\u0003/exit \011");
 107             waitOutput(out, Pattern.quote(getResource("help.exit.summary")) + "\n\n" +
 108                             Pattern.quote(getResource("jshell.console.see.full.documentation")) + "\n\r\u0005/exit ");
 109             inputSink.write("\011");
 110             waitOutput(out, Pattern.quote(getResource("help.exit").replaceAll("\t", "    ")) + "\n" +
 111                             "\r\u0005/exit ");
 112             inputSink.write("\011");
 113             waitOutput(out, Pattern.quote(getResource("help.exit.summary")) + "\n\n" +
 114                             Pattern.quote(getResource("jshell.console.see.full.documentation")) + "\n\r\u0005/exit ");
 115             inputSink.write("\u0003");
 116             inputSink.write("int zebraStripes = 11\n");
 117             waitOutput(out, "zebraStripes ==> 11\n\u0005");
 118             inputSink.write("/exit zeb\011");
 119             waitOutput(out, "braStr.*es");
 120             inputSink.write("\u0003/doesnotexist\011");
 121             waitOutput(out, "\u0005/doesnotexist\n" +
 122                             Pattern.quote(getResource("jshell.console.no.such.command")) + "\n" +
 123                             "\n" +
 124                             "\r\u0005/doesnotexist");
 125         });
 126     }
 127 
 128 }