734b87b97e
Tests can now specify the code generated by a resolve extension from within the test's testdata. Module-level directives control whether resolve extensions are enabled for that module, as well as package names and source shadowing regexes. File-level directives allow a `// FILE:` block within the testdata to be converted into a KtResolveExtensionFile and removed from the module as a whole. (This requires a new `ModuleStructureTransformer`, because we need to be able to entirely remove the files in question.) Any test can add support for these directives by calling `KtResolveExtensionTestSupport.configure` from within their `configureTest` stanza. This allows this functionality to be used in conjuction with any test base class. ^KT-59329
32 lines
682 B
Kotlin
Vendored
32 lines
682 B
Kotlin
Vendored
// MODULE: extendedModule
|
|
// WITH_RESOLVE_EXTENSION
|
|
// RESOLVE_EXTENSION_PACKAGE: generated
|
|
|
|
// FILE: extension.kt
|
|
// RESOLVE_EXTENSION_FILE
|
|
package generated
|
|
|
|
// RESOLVE_EXTENSION_CLASSIFIER: GeneratedClass1
|
|
class GeneratedClass1
|
|
|
|
// RESOLVE_EXTENSION_CALLABLE: generatedTopLevelFunction1
|
|
fun generatedTopLevelFunction1(): GeneratedClass2
|
|
|
|
// FILE: extension2.kt
|
|
// RESOLVE_EXTENSION_FILE
|
|
package generated
|
|
|
|
// RESOLVE_EXTENSION_CLASSIFIER: GeneratedClass2
|
|
class GeneratedClass2 {
|
|
fun generatedClassMember2(): GeneratedClass1
|
|
}
|
|
|
|
// MODULE: dependency2
|
|
|
|
// MODULE: main(extendedModule, dependency2)()()
|
|
import generated.*
|
|
|
|
fun main() {
|
|
generatedTopLevelFunc<caret>tion1()
|
|
}
|