Use JetTestUtils.assertEqualsToFile in usages tests to simplify fixing test data

This commit is contained in:
Nikolay Krasko
2014-11-07 13:32:23 +03:00
parent c2a544d475
commit e8a2039396
3 changed files with 5 additions and 5 deletions
@@ -1,3 +1,3 @@
Function call (16: 7) a.plusAssign(1)
Function call (10: 14) this += a.n Function call (10: 14) this += a.n
Function call (17: 7) a += 1 Function call (16: 7) a.plusAssign(1)
Function call (17: 7) a += 1
@@ -1,2 +1,2 @@
Function call (9: 10) A(1).minus()
Function call (10: 5) -A(1) Function call (10: 5) -A(1)
Function call (9: 10) A(1).minus()
@@ -48,6 +48,7 @@ import kotlin.KotlinPackage;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.InTextDirectivesUtils; import org.jetbrains.jet.InTextDirectivesUtils;
import org.jetbrains.jet.JetTestUtils;
import org.jetbrains.jet.lang.psi.*; import org.jetbrains.jet.lang.psi.*;
import org.jetbrains.jet.plugin.JetLightCodeInsightFixtureTestCase; import org.jetbrains.jet.plugin.JetLightCodeInsightFixtureTestCase;
import org.jetbrains.jet.plugin.JetWithJdkAndRuntimeLightProjectDescriptor; import org.jetbrains.jet.plugin.JetWithJdkAndRuntimeLightProjectDescriptor;
@@ -359,8 +360,7 @@ public abstract class AbstractJetFindUsagesTest extends JetLightCodeInsightFixtu
}; };
Collection<String> finalUsages = Ordering.natural().sortedCopy(Collections2.transform(filteredUsages, convertToString)); Collection<String> finalUsages = Ordering.natural().sortedCopy(Collections2.transform(filteredUsages, convertToString));
String expectedText = FileUtil.loadFile(new File(rootPath, prefix + "results.txt"), true); JetTestUtils.assertEqualsToFile(new File(rootPath, prefix + "results.txt"), StringUtil.join(finalUsages, "\n"));
assertOrderedEquals(finalUsages, Ordering.natural().sortedCopy(StringUtil.split(expectedText, "\n")));
} }
private Collection<UsageInfo> findUsages(@NotNull PsiElement targetElement, @Nullable FindUsagesOptions options) { private Collection<UsageInfo> findUsages(@NotNull PsiElement targetElement, @Nullable FindUsagesOptions options) {