Skip to content

Commit da5f6b8

Browse files
committed
Fix changed indentation rules in 2018.3 with YAML
1 parent 42279bf commit da5f6b8

File tree

1 file changed

+26
-10
lines changed

1 file changed

+26
-10
lines changed

src/test/java/fr/adrienbrault/idea/symfony2plugin/tests/util/yaml/YamlHelperLightTest.java

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package fr.adrienbrault.idea.symfony2plugin.tests.util.yaml;
22

3+
import com.intellij.openapi.application.ApplicationInfo;
34
import com.intellij.psi.PsiElement;
45
import com.intellij.util.Function;
56
import com.intellij.util.containers.ContainerUtil;
@@ -336,16 +337,31 @@ public void testInsertKeyWithArrayValue() {
336337

337338
YamlHelper.insertKeyIntoFile(yamlFile, yamlKeyValue, "services");
338339

339-
assertEquals("" +
340-
"services:\n" +
341-
" foo:\n" +
342-
" car: test\n" +
343-
" my_service:\n" +
344-
" class: foo\n" +
345-
" tag:\n" +
346-
" - foo",
347-
yamlFile.getText()
348-
);
340+
ApplicationInfo instance = ApplicationInfo.getInstance();
341+
String minorVersion = instance.getMinorVersionMainPart();
342+
if (instance.getMajorVersion().equals("2019") || (instance.getMajorVersion().equals("2018") && Integer.valueOf(minorVersion) >= 3)) {
343+
assertEquals("" +
344+
"services:\n" +
345+
" foo:\n" +
346+
" car: test\n" +
347+
" my_service:\n" +
348+
" class: foo\n" +
349+
" tag:\n" +
350+
" - foo",
351+
yamlFile.getText()
352+
);
353+
} else {
354+
assertEquals("" +
355+
"services:\n" +
356+
" foo:\n" +
357+
" car: test\n" +
358+
" my_service:\n" +
359+
" class: foo\n" +
360+
" tag:\n" +
361+
" - foo",
362+
yamlFile.getText()
363+
);
364+
}
349365
}
350366

351367
/**

0 commit comments

Comments
 (0)