< prev index next >

test/langtools/tools/javac/switchexpr/CRT.java

Print this page




 134                "             4,  4,    c21,    c22,    8        //  4,  4,    3:33,    3:34, flow-controller\n" +
 135                "            24, 27,   1017,   101c,   11        // 24, 27,    4:23,    4:28, statement, flow-target\n" +
 136                "            28, 31,   1418,   141e,   11        // 28, 31,    5:24,    5:30, statement, flow-target\n" +
 137                "             4, 31,    c19,   180a,   10        //  4, 31,    3:25,    6:10, flow-target\n" +
 138                "            35, 35,   1815,   1816,    8        // 35, 35,    6:21,    6:22, flow-controller\n" +
 139                "            56, 59,   1c18,   1c1e,   11        // 56, 59,    7:24,    7:30, statement, flow-target\n" +
 140                "            60, 63,   2018,   201d,   11        // 60, 63,    8:24,    8:29, statement, flow-target\n" +
 141                "            35, 63,   180d,   240a,   10        // 35, 63,    6:13,    9:10, flow-target\n" +
 142                "             0, 64,    c09,   240b,    1        //  0, 64,    3:09,    9:11, statement\n" +
 143                "             0, 64,    824,   2806,    2        //  0, 64,    2:36,   10:06, block\n");
 144     }
 145 
 146     private void doTest(String code, String expected) throws Exception {
 147         Path base = Paths.get(".");
 148         Path classes = base.resolve("classes");
 149         tb.createDirectories(classes);
 150         tb.cleanDirectory(classes);
 151         new JavacTask(tb)
 152                 .options("-Xjcov",
 153                          "--enable-preview",
 154                          "-source", "12")
 155                 .outdir(classes)
 156                 .sources("public class Test {\n" +
 157                          code +
 158                          "}\n")
 159                 .run()
 160                 .writeAll();
 161         String out = new JavapTask(tb)
 162                 .options("-private",
 163                          "-verbose",
 164                          "-s")
 165                 .classpath(classes.toString())
 166                 .classes("Test")
 167                 .run()
 168                 .writeAll()
 169                 .getOutputLines(OutputKind.DIRECT)
 170                 .stream()
 171                 .collect(Collectors.joining("\n"));
 172         String crt = cutCRT(out);
 173         if (!expected.trim().equals(crt.trim())) {
 174             throw new AssertionError("Expected CharacterRangeTable not found, found: " + crt);


 134                "             4,  4,    c21,    c22,    8        //  4,  4,    3:33,    3:34, flow-controller\n" +
 135                "            24, 27,   1017,   101c,   11        // 24, 27,    4:23,    4:28, statement, flow-target\n" +
 136                "            28, 31,   1418,   141e,   11        // 28, 31,    5:24,    5:30, statement, flow-target\n" +
 137                "             4, 31,    c19,   180a,   10        //  4, 31,    3:25,    6:10, flow-target\n" +
 138                "            35, 35,   1815,   1816,    8        // 35, 35,    6:21,    6:22, flow-controller\n" +
 139                "            56, 59,   1c18,   1c1e,   11        // 56, 59,    7:24,    7:30, statement, flow-target\n" +
 140                "            60, 63,   2018,   201d,   11        // 60, 63,    8:24,    8:29, statement, flow-target\n" +
 141                "            35, 63,   180d,   240a,   10        // 35, 63,    6:13,    9:10, flow-target\n" +
 142                "             0, 64,    c09,   240b,    1        //  0, 64,    3:09,    9:11, statement\n" +
 143                "             0, 64,    824,   2806,    2        //  0, 64,    2:36,   10:06, block\n");
 144     }
 145 
 146     private void doTest(String code, String expected) throws Exception {
 147         Path base = Paths.get(".");
 148         Path classes = base.resolve("classes");
 149         tb.createDirectories(classes);
 150         tb.cleanDirectory(classes);
 151         new JavacTask(tb)
 152                 .options("-Xjcov",
 153                          "--enable-preview",
 154                          "-source", "13")
 155                 .outdir(classes)
 156                 .sources("public class Test {\n" +
 157                          code +
 158                          "}\n")
 159                 .run()
 160                 .writeAll();
 161         String out = new JavapTask(tb)
 162                 .options("-private",
 163                          "-verbose",
 164                          "-s")
 165                 .classpath(classes.toString())
 166                 .classes("Test")
 167                 .run()
 168                 .writeAll()
 169                 .getOutputLines(OutputKind.DIRECT)
 170                 .stream()
 171                 .collect(Collectors.joining("\n"));
 172         String crt = cutCRT(out);
 173         if (!expected.trim().equals(crt.trim())) {
 174             throw new AssertionError("Expected CharacterRangeTable not found, found: " + crt);
< prev index next >