From 7010bb3468ba6167f602e6b8db2cf2d6a6df0a31 Mon Sep 17 00:00:00 2001 From: "Ilya.Kazakevich" Date: Tue, 27 Mar 2018 04:19:14 +0300 Subject: [PATCH] test fix: remove comments from ironpython skeletons --- .../env/python/dotNet/SkeletonTestTask.java | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/python/testSrc/com/jetbrains/env/python/dotNet/SkeletonTestTask.java b/python/testSrc/com/jetbrains/env/python/dotNet/SkeletonTestTask.java index ea00031c55d3..78420f328176 100644 --- a/python/testSrc/com/jetbrains/env/python/dotNet/SkeletonTestTask.java +++ b/python/testSrc/com/jetbrains/env/python/dotNet/SkeletonTestTask.java @@ -13,10 +13,8 @@ import com.intellij.openapi.progress.util.AbstractProgressIndicatorBase; import com.intellij.openapi.projectRoots.Sdk; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.io.StreamUtil; -import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.PsiDocumentManager; import com.intellij.rt.execution.junit.FileComparisonFailure; -import com.intellij.util.ui.UIUtil; import com.jetbrains.env.PyExecutionFixtureTestTask; import com.jetbrains.env.PyTestTask; import com.jetbrains.python.PyBundle; @@ -36,8 +34,6 @@ import java.io.FileInputStream; import java.io.IOException; import java.nio.charset.Charset; import java.util.Collections; -import java.util.Iterator; -import java.util.List; import java.util.Set; /** @@ -142,27 +138,20 @@ class SkeletonTestTask extends PyExecutionFixtureTestTask { // TODO: Move to separate method ? if (!Matchers.equalToIgnoringWhiteSpace(removeGeneratorVersion(skeletonText)).matches(removeGeneratorVersion(actual))) { - throw new FileComparisonFailure("asd", skeletonText, actual, skeletonFile.getAbsolutePath()); + throw new FileComparisonFailure("Wrong skeleton generated", skeletonText, actual, skeletonFile.getAbsolutePath()); } } myFixture.configureByFile(skeletonFile.getName()); } /** - * Removes strings that starts with "# by generator", because generator version may change + * Removes strings that starts with "#", because generator version and other stuff may change * * @param textToClean text to remove strings from * @return text after cleanup */ private static String removeGeneratorVersion(@NotNull final String textToClean) { - final List strings = StringUtil.split(textToClean, "\n"); - final Iterator iterator = strings.iterator(); - while (iterator.hasNext()) { - if (iterator.next().startsWith("# by generator")) { - iterator.remove(); - } - } - return StringUtil.join(strings, "\n"); + return textToClean.replaceAll("#.+", ""); }