[tests] 'yield' spacing tests

GitOrigin-RevId: 94af1e9668f8c64a0de7f8c0a80f58e062051af6
This commit is contained in:
Roman Shevchenko
2019-07-02 06:52:16 +03:00
committed by intellij-monorepo-bot
parent faf2d25abf
commit 4f2967ab2b
@@ -1,4 +1,4 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.java.psi.formatter.java;
import com.intellij.JavaTestUtil;
@@ -755,4 +755,20 @@ public class JavaFormatterSpaceTest extends AbstractJavaFormatterTest {
" case 4: break;\n" +
"}");
}
public void testYieldStatementSpacing() {
getSettings().CASE_STATEMENT_ON_NEW_LINE = false;
doMethodTest("String s = switch (i) {\n" +
" case 0: yield(foo) ;\n" +
" case 1: yield\n 42 ;\n" +
" case 3: yield label ;\n" +
" case 4: yield ;\n" +
"}",
"String s = switch (i) {\n" +
" case 0: yield (foo);\n" +
" case 1: yield 42;\n" +
" case 3: yield label;\n" +
" case 4: yield ;\n" +
"}");
}
}