Modify file exists assertion.
Additionally allow to check if file exists in any location, even outside of the project. ^KT-45745 In Progress
This commit is contained in:
+2
-2
@@ -20,7 +20,7 @@ class SimpleKotlinGradleIT : KGPBaseTest() {
|
|||||||
) {
|
) {
|
||||||
build("compileDeployKotlin", "build") {
|
build("compileDeployKotlin", "build") {
|
||||||
assertOutputContains("Finished executing kotlin compiler using daemon strategy")
|
assertOutputContains("Finished executing kotlin compiler using daemon strategy")
|
||||||
assertFileExists("build/reports/tests/test/classes/demo.TestSource.html")
|
assertFileInProjectExists("build/reports/tests/test/classes/demo.TestSource.html")
|
||||||
assertTasksExecuted(":compileKotlin", ":compileTestKotlin", ":compileDeployKotlin")
|
assertTasksExecuted(":compileKotlin", ":compileTestKotlin", ":compileDeployKotlin")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ class SimpleKotlinGradleIT : KGPBaseTest() {
|
|||||||
fun testModuleName(gradleVersion: GradleVersion) {
|
fun testModuleName(gradleVersion: GradleVersion) {
|
||||||
project("moduleName", gradleVersion) {
|
project("moduleName", gradleVersion) {
|
||||||
build("build") {
|
build("build") {
|
||||||
assertFileExists("build/classes/kotlin/main/META-INF/FLAG.kotlin_module")
|
assertFileInProjectExists("build/classes/kotlin/main/META-INF/FLAG.kotlin_module")
|
||||||
assertFileNotExists("build/classes/kotlin/main/META-INF/moduleName.kotlin_module")
|
assertFileNotExists("build/classes/kotlin/main/META-INF/moduleName.kotlin_module")
|
||||||
assertOutputDoesNotContain("Argument -module-name is passed multiple times")
|
assertOutputDoesNotContain("Argument -module-name is passed multiple times")
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-9
@@ -6,21 +6,30 @@
|
|||||||
package org.jetbrains.kotlin.gradle.testbase
|
package org.jetbrains.kotlin.gradle.testbase
|
||||||
|
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
|
import java.nio.file.Path
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Asserts file under [file] path exists and is a regular file.
|
||||||
|
*/
|
||||||
|
fun TestProject.assertFileExists(
|
||||||
|
file: Path
|
||||||
|
) {
|
||||||
|
assert(Files.exists(file)) {
|
||||||
|
"File '${file}' does not exist!"
|
||||||
|
}
|
||||||
|
|
||||||
|
assert(Files.isRegularFile(file)) {
|
||||||
|
"'${file}' is not a regular file!"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Asserts file under [pathToFile] relative to the test project exists and is a regular file.
|
* Asserts file under [pathToFile] relative to the test project exists and is a regular file.
|
||||||
*/
|
*/
|
||||||
fun TestProject.assertFileExists(
|
fun TestProject.assertFileInProjectExists(
|
||||||
pathToFile: String
|
pathToFile: String
|
||||||
) {
|
) {
|
||||||
val filePath = projectPath.resolve(pathToFile)
|
assertFileExists(projectPath.resolve(pathToFile))
|
||||||
assert(Files.exists(filePath)) {
|
|
||||||
"File '${filePath}' does not exist!"
|
|
||||||
}
|
|
||||||
|
|
||||||
assert(Files.isRegularFile(filePath)) {
|
|
||||||
"'${filePath}' is not a regular file!"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user