Skip to content

Commit 1eb302b

Browse files
committed
Fix whitespace issues in fixtures
Long-term, this should be refactored to use the built-in comparison methods.
1 parent 88c8dc0 commit 1eb302b

File tree

2 files changed

+68
-28
lines changed

2 files changed

+68
-28
lines changed

src/test/java/fr/adrienbrault/idea/symfony2plugin/tests/intentions/yaml/dic/YamlCreateServiceArgumentsCallbackTest.java

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

3+
import com.intellij.openapi.application.ApplicationInfo;
34
import com.intellij.openapi.application.ApplicationManager;
45
import com.intellij.openapi.command.CommandProcessor;
56
import com.intellij.psi.util.PsiTreeUtil;
@@ -47,14 +48,26 @@ public void run() {
4748
}
4849
}, null, null);
4950

50-
assertEquals("" +
51-
"services:\n" +
52-
" foo:\n" +
53-
" class: Foo\\Foo\n" +
54-
" arguments: ['@foo', '@?', '@?']\n",
55-
yamlFile.getText()
56-
);
57-
51+
ApplicationInfo instance = ApplicationInfo.getInstance();
52+
String minorVersion = instance.getMinorVersion();
53+
if ((instance.getMajorVersion().equals("2018") && Integer.valueOf(minorVersion) >= 2)) {
54+
assertEquals("" +
55+
"services:\n" +
56+
" foo:\n" +
57+
" class: Foo\\Foo\n" +
58+
" arguments:\n" +
59+
" ['@foo', '@?', '@?']\n",
60+
yamlFile.getText()
61+
);
62+
} else {
63+
assertEquals("" +
64+
"services:\n" +
65+
" foo:\n" +
66+
" class: Foo\\Foo\n" +
67+
" arguments: ['@foo', '@?', '@?']\n",
68+
yamlFile.getText()
69+
);
70+
}
5871
}
5972

6073
}

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

Lines changed: 47 additions & 20 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;
@@ -16,10 +17,8 @@
1617
import org.jetbrains.yaml.psi.YAMLFile;
1718
import org.jetbrains.yaml.psi.YAMLKeyValue;
1819
import org.jetbrains.yaml.psi.YAMLScalar;
19-
import org.jetbrains.yaml.psi.impl.YAMLArrayImpl;
2020
import org.jetbrains.yaml.psi.impl.YAMLHashImpl;
2121

22-
import java.io.File;
2322
import java.util.ArrayList;
2423
import java.util.Collection;
2524
import java.util.List;
@@ -338,16 +337,31 @@ public void testInsertKeyWithArrayValue() {
338337

339338
YamlHelper.insertKeyIntoFile(yamlFile, yamlKeyValue, "services");
340339

341-
assertEquals("" +
342-
"services:\n" +
343-
" foo:\n" +
344-
" car: test\n" +
345-
" my_service:\n" +
346-
" class: foo\n" +
347-
" tag:\n" +
348-
" - foo",
349-
yamlFile.getText()
350-
);
340+
ApplicationInfo instance = ApplicationInfo.getInstance();
341+
String minorVersion = instance.getMinorVersion();
342+
if ((instance.getMajorVersion().equals("2018") && Integer.valueOf(minorVersion) >= 2)) {
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+
}
351365
}
352366

353367
/**
@@ -366,14 +380,27 @@ public void testInsertKeyValueWithMissingMainKeyInRoot() {
366380

367381
YamlHelper.insertKeyIntoFile(yamlFile, yamlKeyValue, "services");
368382

369-
assertEquals("" +
370-
"foo: foo\n" +
371-
"services:\n" +
372-
" my_service:\n" +
373-
" class: foo\n" +
374-
" tag: foo",
375-
yamlFile.getText()
376-
);
383+
ApplicationInfo instance = ApplicationInfo.getInstance();
384+
String minorVersion = instance.getMinorVersion();
385+
if ((instance.getMajorVersion().equals("2018") && Integer.valueOf(minorVersion) >= 2)) {
386+
assertEquals("" +
387+
"foo: foo\n" +
388+
"services:\n" +
389+
" my_service:\n" +
390+
" class: foo\n" +
391+
" tag: foo",
392+
yamlFile.getText()
393+
);
394+
}else {
395+
assertEquals("" +
396+
"foo: foo\n" +
397+
"services:\n" +
398+
" my_service:\n" +
399+
" class: foo\n" +
400+
" tag: foo",
401+
yamlFile.getText()
402+
);
403+
}
377404
}
378405

379406
/**

0 commit comments

Comments
 (0)