Don't check trailing spaces because idea removes them by default

This commit is contained in:
Nikolay Krasko
2014-04-25 19:37:27 +04:00
parent da4e62e4be
commit f11e35f988
2 changed files with 25 additions and 3 deletions
@@ -69,6 +69,7 @@ import org.jetbrains.jet.lexer.JetTokens;
import org.jetbrains.jet.plugin.JetLanguage;
import org.jetbrains.jet.test.InnerTestClasses;
import org.jetbrains.jet.test.TestMetadata;
import org.jetbrains.jet.test.util.UtilPackage;
import org.jetbrains.jet.util.slicedmap.ReadOnlySlice;
import org.jetbrains.jet.util.slicedmap.SlicedMap;
import org.jetbrains.jet.util.slicedmap.WritableSlice;
@@ -437,9 +438,11 @@ public class JetTestUtils {
}
String expected = FileUtil.loadFile(expectedFile, CharsetToolkit.UTF8, true);
// compare with hard copy: make sure nothing is lost in output
String expectedText = StringUtil.convertLineSeparators(expected.trim());
String actualText = StringUtil.convertLineSeparators(actual.trim());
String expectedText = UtilPackage.removeTrailingWhitespacesFromEachLine(
StringUtil.convertLineSeparators(expected.trim()));
String actualText = UtilPackage.removeTrailingWhitespacesFromEachLine(
StringUtil.convertLineSeparators(actual.trim()));
if (!Comparing.equal(expectedText, actualText)) {
throw new FileComparisonFailure("Actual data differs from file content: " + expectedFile.getName(),
expected, actual, expectedFile.getAbsolutePath());
@@ -0,0 +1,19 @@
/*
* Copyright 2010-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.jet.test.util
fun String.removeTrailingWhitespacesFromEachLine() = split('\n') map { it.trimTrailing() } makeString ("\n")