test/jdk/jshell/ToolCommandOptionTest.java

Print this page




  71                 (a) -> assertCommand(a, "class C {}",
  72                         "|  created class C"),
  73                 (a) -> assertCommand(a, "/ty",
  74                         "|    class C"),
  75                 (a) -> assertCommand(a, "/ty -st",
  76                         ""),
  77                 (a) -> assertCommand(a, "/types -all",
  78                         "|    class C"),
  79                 (a) -> assertCommand(a, "/types -furball",
  80                         "|  Unknown option: -furball -- /types -furball"),
  81                 (a) -> assertCommand(a, "/types C",
  82                         "|    class C"),
  83                 (a) -> assertCommand(a, "/types C -start",
  84                         "|  Options and snippets must not both be used: /types C -start"),
  85                 (a) -> assertCommand(a, "/ty -st -al",
  86                         "|  Conflicting options -- /types -st -al")
  87         );
  88     }
  89 
  90     public void dropTest() {
  91         test(false, new String[]{"-nostartup"},
  92                 (a) -> assertCommand(a, "int x = 5;",
  93                         "x ==> 5"),
  94                 (a) -> assertCommand(a, "x",
  95                         "x ==> 5"),
  96                 (a) -> assertCommand(a, "long y;",
  97                         "y ==> 0"),
  98                 (a) -> assertCommand(a, "/drop -furball",
  99                         "|  Unknown option: -furball -- /drop -furball"),
 100                 (a) -> assertCommand(a, "/drop -all",
 101                         "|  Unknown option: -all -- /drop -all"),
 102                 (a) -> assertCommandOutputStartsWith(a, "/drop z",
 103                         "|  No such snippet: z"),
 104                 (a) -> assertCommandOutputStartsWith(a, "/drop 2",
 105                         "|  This command does not accept the snippet '2' : x"),
 106                 (a) -> assertCommand(a, "/dr x y",
 107                         "|  dropped variable x\n" +
 108                         "|  dropped variable y"),
 109                 (a) -> assertCommand(a, "/list",
 110                         "2 : x")
 111         );




  71                 (a) -> assertCommand(a, "class C {}",
  72                         "|  created class C"),
  73                 (a) -> assertCommand(a, "/ty",
  74                         "|    class C"),
  75                 (a) -> assertCommand(a, "/ty -st",
  76                         ""),
  77                 (a) -> assertCommand(a, "/types -all",
  78                         "|    class C"),
  79                 (a) -> assertCommand(a, "/types -furball",
  80                         "|  Unknown option: -furball -- /types -furball"),
  81                 (a) -> assertCommand(a, "/types C",
  82                         "|    class C"),
  83                 (a) -> assertCommand(a, "/types C -start",
  84                         "|  Options and snippets must not both be used: /types C -start"),
  85                 (a) -> assertCommand(a, "/ty -st -al",
  86                         "|  Conflicting options -- /types -st -al")
  87         );
  88     }
  89 
  90     public void dropTest() {
  91         test(false, new String[]{"--no-startup"},
  92                 (a) -> assertCommand(a, "int x = 5;",
  93                         "x ==> 5"),
  94                 (a) -> assertCommand(a, "x",
  95                         "x ==> 5"),
  96                 (a) -> assertCommand(a, "long y;",
  97                         "y ==> 0"),
  98                 (a) -> assertCommand(a, "/drop -furball",
  99                         "|  Unknown option: -furball -- /drop -furball"),
 100                 (a) -> assertCommand(a, "/drop -all",
 101                         "|  Unknown option: -all -- /drop -all"),
 102                 (a) -> assertCommandOutputStartsWith(a, "/drop z",
 103                         "|  No such snippet: z"),
 104                 (a) -> assertCommandOutputStartsWith(a, "/drop 2",
 105                         "|  This command does not accept the snippet '2' : x"),
 106                 (a) -> assertCommand(a, "/dr x y",
 107                         "|  dropped variable x\n" +
 108                         "|  dropped variable y"),
 109                 (a) -> assertCommand(a, "/list",
 110                         "2 : x")
 111         );