Add UI options for comments generation (KT-5590)
#KT-5590 Fixed
This commit is contained in:
+1
@@ -115,6 +115,7 @@
|
||||
<Problem reference="com.intellij.util.AstLoadingFilter" reason="Absent in 181. Almost all methods were renamed in 183. Use org.jetbrains.kotlin.util.AstLoadingFilter instead." />
|
||||
<Problem reference="com.intellij.testFramework.codeInsight.hierarchy.HierarchyViewTestFixture" reason="Absent in <= 181. Use org.jetbrains.kotlin.test.HierarchyViewTestFixture instead." />
|
||||
<Problem reference="org.jetbrains.kotlin.test.HierarchyViewTestFixtureCompat" reason="Do not use the wrapper for 181 directly. Use org.jetbrains.kotlin.test.HierarchyViewTestFixture instead." />
|
||||
<Problem reference="com.intellij.psi.codeStyle.CodeStyleSettingsProvider" reason="Additional method is introduced in 183 instead of deprecated one. Use CodeStyleSettingsProviderCompat instead." />
|
||||
</list>
|
||||
</option>
|
||||
</inspection_tool>
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.intellij.lang.Language;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class KotlinLanguage extends Language {
|
||||
@NotNull
|
||||
public static final KotlinLanguage INSTANCE = new KotlinLanguage();
|
||||
public static final String NAME = "Kotlin";
|
||||
|
||||
|
||||
@@ -635,18 +635,25 @@ public class KotlinTestUtils {
|
||||
}
|
||||
|
||||
public static void assertEqualsToFile(@NotNull File expectedFile, @NotNull Editor editor) {
|
||||
Caret caret = editor.getCaretModel().getCurrentCaret();
|
||||
int selectionStart = caret.getSelectionStart();
|
||||
int selectionEnd = caret.getSelectionEnd();
|
||||
assertEqualsToFile(expectedFile, editor, true);
|
||||
}
|
||||
|
||||
String afterText = TagsTestDataUtil.insertTagsInText(
|
||||
Lists.<TagsTestDataUtil.TagInfo>newArrayList(
|
||||
new TagsTestDataUtil.TagInfo<>(caret.getOffset(), true, "caret"),
|
||||
new TagsTestDataUtil.TagInfo<>(selectionStart, true, "selection"),
|
||||
new TagsTestDataUtil.TagInfo<>(selectionEnd, false, "selection")),
|
||||
editor.getDocument().getText()
|
||||
public static void assertEqualsToFile(@NotNull File expectedFile, @NotNull Editor editor, Boolean enableSelectionTags) {
|
||||
Caret caret = editor.getCaretModel().getCurrentCaret();
|
||||
List<TagsTestDataUtil.TagInfo> tags = Lists.newArrayList(
|
||||
new TagsTestDataUtil.TagInfo<>(caret.getOffset(), true, "caret")
|
||||
);
|
||||
|
||||
if (enableSelectionTags) {
|
||||
int selectionStart = caret.getSelectionStart();
|
||||
int selectionEnd = caret.getSelectionEnd();
|
||||
|
||||
tags.add(new TagsTestDataUtil.TagInfo<>(selectionStart, true, "selection"));
|
||||
tags.add(new TagsTestDataUtil.TagInfo<>(selectionEnd, false, "selection"));
|
||||
}
|
||||
|
||||
String afterText = TagsTestDataUtil.insertTagsInText(tags, editor.getDocument().getText());
|
||||
|
||||
assertEqualsToFile(expectedFile, afterText);
|
||||
}
|
||||
|
||||
|
||||
@@ -631,18 +631,25 @@ public class KotlinTestUtils {
|
||||
}
|
||||
|
||||
public static void assertEqualsToFile(@NotNull File expectedFile, @NotNull Editor editor) {
|
||||
Caret caret = editor.getCaretModel().getCurrentCaret();
|
||||
int selectionStart = caret.getSelectionStart();
|
||||
int selectionEnd = caret.getSelectionEnd();
|
||||
assertEqualsToFile(expectedFile, editor, true);
|
||||
}
|
||||
|
||||
String afterText = TagsTestDataUtil.insertTagsInText(
|
||||
Lists.<TagsTestDataUtil.TagInfo>newArrayList(
|
||||
new TagsTestDataUtil.TagInfo<>(caret.getOffset(), true, "caret"),
|
||||
new TagsTestDataUtil.TagInfo<>(selectionStart, true, "selection"),
|
||||
new TagsTestDataUtil.TagInfo<>(selectionEnd, false, "selection")),
|
||||
editor.getDocument().getText()
|
||||
public static void assertEqualsToFile(@NotNull File expectedFile, @NotNull Editor editor, Boolean enableSelectionTags) {
|
||||
Caret caret = editor.getCaretModel().getCurrentCaret();
|
||||
List<TagsTestDataUtil.TagInfo> tags = Lists.newArrayList(
|
||||
new TagsTestDataUtil.TagInfo<>(caret.getOffset(), true, "caret")
|
||||
);
|
||||
|
||||
if (enableSelectionTags) {
|
||||
int selectionStart = caret.getSelectionStart();
|
||||
int selectionEnd = caret.getSelectionEnd();
|
||||
|
||||
tags.add(new TagsTestDataUtil.TagInfo<>(selectionStart, true, "selection"));
|
||||
tags.add(new TagsTestDataUtil.TagInfo<>(selectionEnd, false, "selection"));
|
||||
}
|
||||
|
||||
String afterText = TagsTestDataUtil.insertTagsInText(tags, editor.getDocument().getText());
|
||||
|
||||
assertEqualsToFile(expectedFile, afterText);
|
||||
}
|
||||
|
||||
|
||||
@@ -631,18 +631,25 @@ public class KotlinTestUtils {
|
||||
}
|
||||
|
||||
public static void assertEqualsToFile(@NotNull File expectedFile, @NotNull Editor editor) {
|
||||
Caret caret = editor.getCaretModel().getCurrentCaret();
|
||||
int selectionStart = caret.getSelectionStart();
|
||||
int selectionEnd = caret.getSelectionEnd();
|
||||
assertEqualsToFile(expectedFile, editor, true);
|
||||
}
|
||||
|
||||
String afterText = TagsTestDataUtil.insertTagsInText(
|
||||
Lists.<TagsTestDataUtil.TagInfo>newArrayList(
|
||||
new TagsTestDataUtil.TagInfo<>(caret.getOffset(), true, "caret"),
|
||||
new TagsTestDataUtil.TagInfo<>(selectionStart, true, "selection"),
|
||||
new TagsTestDataUtil.TagInfo<>(selectionEnd, false, "selection")),
|
||||
editor.getDocument().getText()
|
||||
public static void assertEqualsToFile(@NotNull File expectedFile, @NotNull Editor editor, Boolean enableSelectionTags) {
|
||||
Caret caret = editor.getCaretModel().getCurrentCaret();
|
||||
List<TagsTestDataUtil.TagInfo> tags = Lists.newArrayList(
|
||||
new TagsTestDataUtil.TagInfo<>(caret.getOffset(), true, "caret")
|
||||
);
|
||||
|
||||
if (enableSelectionTags) {
|
||||
int selectionStart = caret.getSelectionStart();
|
||||
int selectionEnd = caret.getSelectionEnd();
|
||||
|
||||
tags.add(new TagsTestDataUtil.TagInfo<>(selectionStart, true, "selection"));
|
||||
tags.add(new TagsTestDataUtil.TagInfo<>(selectionEnd, false, "selection"));
|
||||
}
|
||||
|
||||
String afterText = TagsTestDataUtil.insertTagsInText(tags, editor.getDocument().getText());
|
||||
|
||||
assertEqualsToFile(expectedFile, afterText);
|
||||
}
|
||||
|
||||
|
||||
@@ -631,18 +631,25 @@ public class KotlinTestUtils {
|
||||
}
|
||||
|
||||
public static void assertEqualsToFile(@NotNull File expectedFile, @NotNull Editor editor) {
|
||||
Caret caret = editor.getCaretModel().getCurrentCaret();
|
||||
int selectionStart = caret.getSelectionStart();
|
||||
int selectionEnd = caret.getSelectionEnd();
|
||||
assertEqualsToFile(expectedFile, editor, true);
|
||||
}
|
||||
|
||||
String afterText = TagsTestDataUtil.insertTagsInText(
|
||||
Lists.<TagsTestDataUtil.TagInfo>newArrayList(
|
||||
new TagsTestDataUtil.TagInfo<>(caret.getOffset(), true, "caret"),
|
||||
new TagsTestDataUtil.TagInfo<>(selectionStart, true, "selection"),
|
||||
new TagsTestDataUtil.TagInfo<>(selectionEnd, false, "selection")),
|
||||
editor.getDocument().getText()
|
||||
public static void assertEqualsToFile(@NotNull File expectedFile, @NotNull Editor editor, Boolean enableSelectionTags) {
|
||||
Caret caret = editor.getCaretModel().getCurrentCaret();
|
||||
List<TagsTestDataUtil.TagInfo> tags = Lists.newArrayList(
|
||||
new TagsTestDataUtil.TagInfo<>(caret.getOffset(), true, "caret")
|
||||
);
|
||||
|
||||
if (enableSelectionTags) {
|
||||
int selectionStart = caret.getSelectionStart();
|
||||
int selectionEnd = caret.getSelectionEnd();
|
||||
|
||||
tags.add(new TagsTestDataUtil.TagInfo<>(selectionStart, true, "selection"));
|
||||
tags.add(new TagsTestDataUtil.TagInfo<>(selectionEnd, false, "selection"));
|
||||
}
|
||||
|
||||
String afterText = TagsTestDataUtil.insertTagsInText(tags, editor.getDocument().getText());
|
||||
|
||||
assertEqualsToFile(expectedFile, afterText);
|
||||
}
|
||||
|
||||
|
||||
@@ -441,6 +441,7 @@
|
||||
<additionalTextAttributes scheme="Default" file="colorScheme/Default_Kotlin.xml"/>
|
||||
<additionalTextAttributes scheme="Darcula" file="colorScheme/Darcula_Kotlin.xml"/>
|
||||
|
||||
<codeStyleSettingsProvider implementation="org.jetbrains.kotlin.idea.formatter.KotlinGenerationSettingsProvider"/>
|
||||
<codeStyleSettingsProvider implementation="org.jetbrains.kotlin.idea.formatter.KotlinCodeStyleSettingsProvider"/>
|
||||
<langCodeStyleSettingsProvider implementation="org.jetbrains.kotlin.idea.formatter.KotlinLanguageCodeStyleSettingsProvider"/>
|
||||
<predefinedCodeStyle implementation="org.jetbrains.kotlin.idea.formatter.KotlinStyleGuideCodeStyle"/>
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright 2010-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/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.idea.formatter;
|
||||
|
||||
import com.intellij.openapi.options.Configurable;
|
||||
import com.intellij.psi.codeStyle.CodeStyleConfigurable;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettingsProvider;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
// Additional method is introduced in 183 instead of deprecated one
|
||||
// BUNCH: 182
|
||||
@SuppressWarnings("IncompatibleAPI")
|
||||
public abstract class CodeStyleSettingsProviderCompat extends CodeStyleSettingsProvider {
|
||||
// Can't use @Override because it's going to be an error in 182
|
||||
@SuppressWarnings("override")
|
||||
@NotNull
|
||||
public abstract CodeStyleConfigurable createConfigurable(@NotNull CodeStyleSettings settings, @NotNull CodeStyleSettings modelSettings);
|
||||
|
||||
// Should be implemented or it's going to be error in 182
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
@NotNull
|
||||
public Configurable createSettingsPage(@NotNull CodeStyleSettings settings, @NotNull CodeStyleSettings modelSettings) {
|
||||
return createConfigurable(settings, modelSettings);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright 2010-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/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.idea.formatter
|
||||
|
||||
import com.intellij.application.options.codeStyle.CommenterForm
|
||||
import com.intellij.openapi.application.ApplicationBundle
|
||||
import com.intellij.psi.codeStyle.CodeStyleConfigurable
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings
|
||||
import com.intellij.psi.codeStyle.DisplayPriority
|
||||
import com.intellij.ui.IdeBorderFactory
|
||||
import com.intellij.util.ui.JBInsets
|
||||
import org.jetbrains.kotlin.idea.KotlinLanguage
|
||||
import javax.swing.BoxLayout
|
||||
import javax.swing.JComponent
|
||||
import javax.swing.JPanel
|
||||
|
||||
class KotlinGenerationSettingsProvider : CodeStyleSettingsProviderCompat() {
|
||||
override fun createConfigurable(settings: CodeStyleSettings, modelSettings: CodeStyleSettings): CodeStyleConfigurable {
|
||||
return KotlinCodeStyleGenerationConfigurable(settings)
|
||||
}
|
||||
|
||||
override fun getConfigurableDisplayName(): String = ApplicationBundle.message("title.code.generation")
|
||||
override fun getPriority(): DisplayPriority = DisplayPriority.CODE_SETTINGS
|
||||
override fun hasSettingsPage() = false
|
||||
override fun getLanguage() = KotlinLanguage.INSTANCE
|
||||
}
|
||||
|
||||
class KotlinCodeStyleGenerationConfigurable(private val mySettings: CodeStyleSettings) : CodeStyleConfigurable {
|
||||
private val myCommenterForm: CommenterForm = CommenterForm(KotlinLanguage.INSTANCE)
|
||||
|
||||
override fun getDisplayName(): String = ApplicationBundle.message("title.code.generation")
|
||||
|
||||
override fun createComponent(): JComponent {
|
||||
return JPanel().apply {
|
||||
layout = BoxLayout(this, BoxLayout.Y_AXIS)
|
||||
border = IdeBorderFactory.createEmptyBorder(JBInsets(0, 10, 10, 10))
|
||||
add(myCommenterForm.commenterPanel)
|
||||
}
|
||||
}
|
||||
|
||||
override fun isModified(): Boolean {
|
||||
return myCommenterForm.isModified(mySettings)
|
||||
}
|
||||
|
||||
override fun apply() {
|
||||
apply(mySettings)
|
||||
}
|
||||
|
||||
override fun reset() {
|
||||
reset(mySettings)
|
||||
}
|
||||
|
||||
override fun reset(settings: CodeStyleSettings) {
|
||||
myCommenterForm.reset(settings)
|
||||
}
|
||||
|
||||
override fun apply(settings: CodeStyleSettings) {
|
||||
myCommenterForm.apply(settings)
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ import com.intellij.application.options.CodeStyleAbstractConfigurable;
|
||||
import com.intellij.application.options.CodeStyleAbstractPanel;
|
||||
import com.intellij.application.options.TabbedLanguageCodeStylePanel;
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.openapi.options.Configurable;
|
||||
import com.intellij.psi.codeStyle.CodeStyleConfigurable;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettingsProvider;
|
||||
import com.intellij.psi.codeStyle.CustomCodeStyleSettings;
|
||||
@@ -28,7 +28,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.idea.KotlinLanguage;
|
||||
import org.jetbrains.kotlin.idea.core.formatter.KotlinCodeStyleSettings;
|
||||
|
||||
public class KotlinCodeStyleSettingsProvider extends CodeStyleSettingsProvider {
|
||||
public class KotlinCodeStyleSettingsProvider extends CodeStyleSettingsProviderCompat {
|
||||
|
||||
@Override
|
||||
public String getConfigurableDisplayName() {
|
||||
@@ -47,8 +47,8 @@ public class KotlinCodeStyleSettingsProvider extends CodeStyleSettingsProvider {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Configurable createSettingsPage(CodeStyleSettings settings, CodeStyleSettings originalSettings) {
|
||||
return new CodeStyleAbstractConfigurable(settings, originalSettings, KotlinLanguage.NAME) {
|
||||
public CodeStyleConfigurable createConfigurable(@NotNull CodeStyleSettings settings, @NotNull CodeStyleSettings modelSettings) {
|
||||
return new CodeStyleAbstractConfigurable(settings, modelSettings, KotlinLanguage.NAME) {
|
||||
@Override
|
||||
protected CodeStyleAbstractPanel createPanel(CodeStyleSettings settings) {
|
||||
return new TabbedLanguageCodeStylePanel(KotlinLanguage.INSTANCE, getCurrentSettings(), settings) {
|
||||
@@ -60,6 +60,14 @@ public class KotlinCodeStyleSettingsProvider extends CodeStyleSettingsProvider {
|
||||
addWrappingAndBracesTab(settings);
|
||||
addBlankLinesTab(settings);
|
||||
addTab(new ImportSettingsPanelWrapper(settings));
|
||||
|
||||
//noinspection IncompatibleAPI
|
||||
for (CodeStyleSettingsProvider provider : CodeStyleSettingsProvider.EXTENSION_POINT_NAME.getExtensions()) {
|
||||
if (provider.getLanguage() == KotlinLanguage.INSTANCE && !provider.hasSettingsPage()) {
|
||||
createTab(provider);
|
||||
}
|
||||
}
|
||||
|
||||
addTab(new KotlinSaveStylePanel(settings));
|
||||
}
|
||||
};
|
||||
|
||||
+3
@@ -369,6 +369,9 @@ class KotlinLanguageCodeStyleSettingsProvider : LanguageCodeStyleSettingsProvide
|
||||
CodeStyleSettingsCustomizable.BLANK_LINES
|
||||
)
|
||||
}
|
||||
LanguageCodeStyleSettingsProvider.SettingsType.COMMENTER_SETTINGS -> {
|
||||
consumer.showAllStandardOptions();
|
||||
}
|
||||
else -> consumer.showStandardOptions()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
fun test() {
|
||||
print<caret>ln()
|
||||
}
|
||||
|
||||
// SET_FALSE: LINE_COMMENT_AT_FIRST_COLUMN
|
||||
// SET_TRUE: LINE_COMMENT_ADD_SPACE
|
||||
@@ -0,0 +1,6 @@
|
||||
fun test() {
|
||||
// println()
|
||||
}<caret>
|
||||
|
||||
// SET_FALSE: LINE_COMMENT_AT_FIRST_COLUMN
|
||||
// SET_TRUE: LINE_COMMENT_ADD_SPACE
|
||||
@@ -0,0 +1,6 @@
|
||||
fun test() {
|
||||
print<caret>ln()
|
||||
}
|
||||
|
||||
// SET_FALSE: LINE_COMMENT_AT_FIRST_COLUMN
|
||||
// SET_FALSE: LINE_COMMENT_ADD_SPACE
|
||||
@@ -0,0 +1,6 @@
|
||||
fun test() {
|
||||
//println()
|
||||
}<caret>
|
||||
|
||||
// SET_FALSE: LINE_COMMENT_AT_FIRST_COLUMN
|
||||
// SET_FALSE: LINE_COMMENT_ADD_SPACE
|
||||
@@ -141,23 +141,25 @@ public abstract class AbstractFormatterTest extends LightIdeaTestCase {
|
||||
String testFileName = expectedFileNameWithExtension.substring(0, expectedFileNameWithExtension.indexOf("."));
|
||||
String testFileExtension = expectedFileNameWithExtension.substring(expectedFileNameWithExtension.lastIndexOf("."));
|
||||
String originalFileText = FileUtil.loadFile(new File(testFileName + testFileExtension), true);
|
||||
|
||||
CodeStyleSettings codeStyleSettings = FormatSettingsUtil.getSettings();
|
||||
try {
|
||||
Integer rightMargin = InTextDirectivesUtils.getPrefixedInt(originalFileText, "// RIGHT_MARGIN: ");
|
||||
if (rightMargin != null) {
|
||||
codeStyleSettings.setRightMargin(KotlinLanguage.INSTANCE, rightMargin);
|
||||
}
|
||||
|
||||
Integer rightMargin = InTextDirectivesUtils.getPrefixedInt(originalFileText, "// RIGHT_MARGIN: ");
|
||||
if (rightMargin != null) {
|
||||
codeStyleSettings.setRightMargin(KotlinLanguage.INSTANCE, rightMargin);
|
||||
SettingsConfigurator configurator = FormatSettingsUtil.createConfigurator(originalFileText, codeStyleSettings);
|
||||
if (!inverted) {
|
||||
configurator.configureSettings();
|
||||
}
|
||||
else {
|
||||
configurator.configureInvertedSettings();
|
||||
}
|
||||
|
||||
doTextTest(originalFileText, new File(expectedFileNameWithExtension), testFileExtension);
|
||||
} finally {
|
||||
codeStyleSettings.clearCodeStyleSettings();
|
||||
}
|
||||
|
||||
SettingsConfigurator configurator = FormatSettingsUtil.createConfigurator(originalFileText, codeStyleSettings);
|
||||
if (!inverted) {
|
||||
configurator.configureSettings();
|
||||
}
|
||||
else {
|
||||
configurator.configureInvertedSettings();
|
||||
}
|
||||
|
||||
doTextTest(originalFileText, new File(expectedFileNameWithExtension), testFileExtension);
|
||||
|
||||
codeStyleSettings.clearCodeStyleSettings();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,9 +17,13 @@
|
||||
package org.jetbrains.kotlin.idea.editor;
|
||||
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import com.intellij.testFramework.EditorTestUtil;
|
||||
import com.intellij.testFramework.LightCodeInsightTestCase;
|
||||
import org.jetbrains.kotlin.formatter.FormatSettingsUtil;
|
||||
import org.jetbrains.kotlin.idea.test.PluginTestCaseBase;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
import org.jetbrains.kotlin.test.SettingsConfigurator;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@@ -39,21 +43,53 @@ public class KotlinCommenterTest extends LightCodeInsightTestCase {
|
||||
doNewLineTypingTest();
|
||||
}
|
||||
|
||||
public void testNotFirstColumnWithSpace() throws Exception {
|
||||
doLineCommentTest();
|
||||
}
|
||||
|
||||
public void testNotFirstColumnWithoutSpace() throws Exception {
|
||||
doLineCommentTest();
|
||||
}
|
||||
|
||||
private void doNewLineTypingTest() throws Exception {
|
||||
configure();
|
||||
EditorTestUtil.performTypingAction(getEditor(), '\n');
|
||||
check();
|
||||
}
|
||||
|
||||
private void doLineCommentTest() throws Exception {
|
||||
configure();
|
||||
|
||||
CodeStyleSettings codeStyleSettings = FormatSettingsUtil.getSettings();
|
||||
try {
|
||||
String text = myFile.getText();
|
||||
|
||||
SettingsConfigurator configurator = FormatSettingsUtil.createConfigurator(text, codeStyleSettings);
|
||||
configurator.configureSettings();
|
||||
|
||||
executeAction("CommentByLineComment");
|
||||
} finally {
|
||||
codeStyleSettings.clearCodeStyleSettings();
|
||||
}
|
||||
|
||||
check();
|
||||
}
|
||||
|
||||
private void configure() throws Exception {
|
||||
configureFromFileText("a.kt", loadFile(getTestName(true) + ".kt"));
|
||||
}
|
||||
|
||||
private void check() throws Exception {
|
||||
checkResultByText(loadFile(getTestName(true) + "_after.kt"));
|
||||
private void check() {
|
||||
File afterFile = getTestFile(getTestName(true) + "_after.kt");
|
||||
KotlinTestUtils.assertEqualsToFile(afterFile, getEditor(), false);
|
||||
}
|
||||
|
||||
protected static String loadFile(String name) throws Exception {
|
||||
return FileUtil.loadFile(new File(BASE_PATH, name), true);
|
||||
private static File getTestFile(String name) {
|
||||
return new File(BASE_PATH, name);
|
||||
}
|
||||
|
||||
private static String loadFile(String name) throws Exception {
|
||||
File file = getTestFile(name);
|
||||
return FileUtil.loadFile(file, true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user