[BTA tests] Use arbitrary named versions instead of just numbered ones

^KT-61860 In Progress
This commit is contained in:
Alexander.Likhachev
2024-03-07 20:42:25 +01:00
committed by Space Team
parent bc85375a1e
commit e302420197
5 changed files with 9 additions and 9 deletions
@@ -13,7 +13,7 @@ interface ScenarioModule {
/**
* Performs registered existing file modification.
*
* Prefer the overload with versioned file modification if it's possible
* Prefer using [replaceFileWithVersion] if it's possible
*/
fun changeFile(
fileName: String,
@@ -26,9 +26,9 @@ interface ScenarioModule {
*
* Check the example `ExampleIncrementalScenarioTest.testScenario4` out
*/
fun changeFile(
fun replaceFileWithVersion(
fileName: String,
version: UInt,
version: String,
)
/**
@@ -39,7 +39,7 @@ interface ScenarioModule {
/**
* Performs registered new file creation.
*
* Prefer the overload with versioned file modification if it's possible
* Prefer using [createPredefinedFile] if it's possible
*/
fun createFile(fileName: String, content: String)
@@ -47,7 +47,7 @@ interface ScenarioModule {
* Performs registered new file creation by copying a revision from
* the file located by path "[fileName].[version]" in the module sources directory.
*/
fun createFile(fileName: String, version: UInt)
fun createPredefinedFile(fileName: String, version: String)
fun compile(
forceOutput: LogLevel? = null,
@@ -32,7 +32,7 @@ internal class ScenarioModuleImpl(
writeFile(fileName, transform(file.readText()))
}
override fun changeFile(fileName: String, version: UInt) {
override fun replaceFileWithVersion(fileName: String, version: String) {
val file = module.sourcesDirectory.resolve(fileName)
val chosenRevision = module.sourcesDirectory.resolve("$fileName.$version")
Files.delete(file)
@@ -50,7 +50,7 @@ internal class ScenarioModuleImpl(
writeFile(fileName, content)
}
override fun createFile(fileName: String, version: UInt) {
override fun createPredefinedFile(fileName: String, version: String) {
val file = module.sourcesDirectory.resolve(fileName)
val chosenRevision = module.sourcesDirectory.resolve("$fileName.$version")
Files.copy(chosenRevision, file)
@@ -129,7 +129,7 @@ class ExampleIncrementalScenarioTest : BaseCompilationTest() {
val module1 = module("jvm-module-1")
// replaces bar.kt with bar.kt.1
module1.changeFile("bar.kt", 1U)
module1.replaceFileWithVersion("bar.kt", "add-default-argument")
module1.compile {
assertCompiledSources("bar.kt")
@@ -146,7 +146,7 @@ class ExampleIncrementalScenarioTest : BaseCompilationTest() {
val module1 = module("jvm-module-1")
// creates secret.kt from secret.kt.1
module1.createFile("secret.kt", 1U)
module1.createPredefinedFile("secret.kt", "new-file")
module1.compile {
assertCompiledSources("secret.kt")