diff options
author | Simon Ogorodnik <Simon.Ogorodnik@jetbrains.com> | 2017-03-23 16:35:10 +0300 |
---|---|---|
committer | Simon Ogorodnik <Simon.Ogorodnik@jetbrains.com> | 2017-03-23 16:37:33 +0300 |
commit | 0fccc3f91c08b3f3d149a11c81946e1824fc821e (patch) | |
tree | 1a2b3f711e56c96eff60b08f4c7215c698f95509 /core/src/test/kotlin | |
parent | 8f60abd5d1e0dba659c433a9a37561c4d78c1c12 (diff) | |
download | dokka-0fccc3f91c08b3f3d149a11c81946e1824fc821e.tar.gz dokka-0fccc3f91c08b3f3d149a11c81946e1824fc821e.tar.bz2 dokka-0fccc3f91c08b3f3d149a11c81946e1824fc821e.zip |
Add support for nice IDEA feature
Diffstat (limited to 'core/src/test/kotlin')
-rw-r--r-- | core/src/test/kotlin/TestAPI.kt | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/core/src/test/kotlin/TestAPI.kt b/core/src/test/kotlin/TestAPI.kt index 19eb29d5..ee452be3 100644 --- a/core/src/test/kotlin/TestAPI.kt +++ b/core/src/test/kotlin/TestAPI.kt @@ -4,6 +4,7 @@ import com.google.inject.Guice import com.intellij.openapi.application.PathManager import com.intellij.openapi.util.Disposer import com.intellij.openapi.util.io.FileUtil +import com.intellij.rt.execution.junit.FileComparisonFailure import org.jetbrains.dokka.* import org.jetbrains.dokka.Utilities.DokkaAnalysisModule import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation @@ -162,8 +163,8 @@ fun verifyModelOutput(it: DocumentationModule, val output = StringBuilder() outputGenerator(it, output) val ext = outputExtension.removePrefix(".") - val expectedOutput = File(sourcePath.replaceAfterLast(".", ext, sourcePath + "." + ext)).readText() - assertEqualsIgnoringSeparators(expectedOutput, output.toString()) + val expectedFile = File(sourcePath.replaceAfterLast(".", ext, sourcePath + "." + ext)) + assertEqualsIgnoringSeparators(expectedFile, output.toString()) } fun verifyOutput(path: String, @@ -184,6 +185,14 @@ fun verifyJavaOutput(path: String, } } +fun assertEqualsIgnoringSeparators(expectedFile: File, output: String) { + val expectedText = expectedFile.readText().replace("\r\n", "\n") + val actualText = output.replace("\r\n", "\n") + + if(expectedText != actualText) + throw FileComparisonFailure("", expectedText, actualText, expectedFile.canonicalPath) +} + fun assertEqualsIgnoringSeparators(expectedOutput: String, output: String) { Assert.assertEquals(expectedOutput.replace("\r\n", "\n"), output.replace("\r\n", "\n")) } |