unit-tests: Allow user to set a custom entry point for test program

This commit is contained in:
Ilya Matveev
2017-09-25 17:39:25 +03:00
committed by ilmat192
parent 7c906b74fc
commit d5fe0862ac
@@ -38,18 +38,8 @@ internal fun findMainEntryPoint(context: Context): FunctionDescriptor? {
val config = context.config.configuration
if (config.get(KonanConfigKeys.PRODUCE) != CompilerOutputKind.PROGRAM) return null
val userEntryName = config.get(KonanConfigKeys.ENTRY)
val entryPoint: FqName
if (config.getBoolean(KonanConfigKeys.GENERATE_TEST_RUNNER)) {
entryPoint = FqName(testEntryName)
if (userEntryName != null) {
config.report(CompilerMessageSeverity.WARNING,
"Custom entry point is ignored if test runner is generated"
)
}
} else {
entryPoint = FqName(userEntryName ?: defaultEntryName)
}
val entryPoint = FqName(config.get(KonanConfigKeys.ENTRY) ?:
if (context.shouldGenerateTestRunner()) testEntryName else defaultEntryName)
val entryName = entryPoint.shortName()
val packageName = entryPoint.parent()