Add a few tests demonstrating how labelled statements are printed.
It's not immediately obvious that "a: {}" will print as "a: ;" (unless pretty-print is enabled) so it's helpful to have a test that shows that explicitly.
@@ -139,6 +139,8 @@ public final class CodePrinterTest extends CodePrinterTestBase {
// Label
assertPrint("foo:for(;;){break foo;}", "foo:for(;;)break foo");
assertPrint("foo:while(1){continue foo;}", "foo:while(1)continue foo");
+ assertPrintSame("foo:;");
+ assertPrint("foo: {}", "foo:;");
// Object literals.
assertPrint("({})", "({})");
@@ -816,6 +818,8 @@ public final class CodePrinterTest extends CodePrinterTestBase {
"myLabel: {\n" +
" alert();\n" +
"}\n");
+ assertPrettyPrint("myLabel: {}", "myLabel: {\n}\n");
+ assertPrettyPrint("myLabel: ;", "myLabel: ;\n");
// Don't move the label on a loop, because then break {label} and
// continue {label} won't work.
