aboutsummaryrefslogtreecommitdiff
path: root/core/src/test/kotlin
diff options
context:
space:
mode:
authorSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2017-03-23 16:35:10 +0300
committerSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2017-03-23 16:37:33 +0300
commit0fccc3f91c08b3f3d149a11c81946e1824fc821e (patch)
tree1a2b3f711e56c96eff60b08f4c7215c698f95509 /core/src/test/kotlin
parent8f60abd5d1e0dba659c433a9a37561c4d78c1c12 (diff)
downloaddokka-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.kt13
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"))
}