mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Updated typing tests
IDEA-CR-34781
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
// 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.
|
||||
package org.jetbrains.yaml.editing;
|
||||
|
||||
import com.intellij.application.options.CodeStyle;
|
||||
import com.intellij.openapi.application.ex.PathManagerEx;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase;
|
||||
import com.intellij.util.ObjectUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.yaml.formatter.YAMLCodeStyleSettings;
|
||||
|
||||
public class YAMLTypingTest extends LightPlatformCodeInsightFixtureTestCase {
|
||||
@Override
|
||||
@@ -22,8 +27,20 @@ public class YAMLTypingTest extends LightPlatformCodeInsightFixtureTestCase {
|
||||
doTest("\n");
|
||||
}
|
||||
|
||||
public void testNewSequenceItem() {
|
||||
doTest("\n");
|
||||
public void testNewIndentedSequenceItem_indentedSequence() {
|
||||
checkSameResultForAnySequenceIndent("\n", true);
|
||||
}
|
||||
|
||||
public void testNewIndentedSequenceItem_sameIndent() {
|
||||
checkSameResultForAnySequenceIndent("\n", false);
|
||||
}
|
||||
|
||||
public void testNewSequenceItemZeroIndent_indentedSequence() {
|
||||
checkSameResultForAnySequenceIndent("\n", true);
|
||||
}
|
||||
|
||||
public void testNewSequenceItemZeroIndent_sameIndent() {
|
||||
checkSameResultForAnySequenceIndent("\n", false);
|
||||
}
|
||||
|
||||
public void testEmptyInlinedValue() {
|
||||
@@ -51,10 +68,26 @@ public class YAMLTypingTest extends LightPlatformCodeInsightFixtureTestCase {
|
||||
}
|
||||
|
||||
@SuppressWarnings("SameParameterValue")
|
||||
private void doTest(String insert) {
|
||||
private void doTest(@NotNull String insert) {
|
||||
String testName = getTestName(true);
|
||||
myFixture.configureByFile(testName + ".yml");
|
||||
myFixture.type(insert);
|
||||
myFixture.checkResultByFile(testName + ".txt");
|
||||
}
|
||||
|
||||
@SuppressWarnings("SameParameterValue")
|
||||
private void checkSameResultForAnySequenceIndent(@NotNull String insert, boolean indentSequenceVal) {
|
||||
String testName = getTestName(true);
|
||||
String fileName = ObjectUtils.notNull(StringUtil.substringBefore(testName, "_"), testName);
|
||||
myFixture.configureByFile(fileName + ".yml");
|
||||
|
||||
getCustomSettings().INDENT_SEQUENCE_VALUE = indentSequenceVal;
|
||||
myFixture.type(insert);
|
||||
myFixture.checkResultByFile(fileName + ".txt");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private YAMLCodeStyleSettings getCustomSettings() {
|
||||
return CodeStyle.getCustomSettings(myFixture.getFile(), YAMLCodeStyleSettings.class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
top:
|
||||
- hello
|
||||
<caret>
|
||||
@@ -0,0 +1,2 @@
|
||||
top:
|
||||
- hello<caret>
|
||||
Reference in New Issue
Block a user