ladybird/Tests/Resources/SwiftTestMain.swift
Andrew Kaster d953c6b451 Tests: Annotate configurationJSON in SwiftTestMain with noisolate
This was causing some warnings, so annotate this argument we aren't
even using with noisolate(unsafe) to make the compiler stop.
2024-11-26 11:00:48 +01:00

27 lines
902 B
Swift

/*
* Copyright (c) 2024, Andrew Kaster <andrew@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
import Foundation
typealias EntryPoint = @convention(thin) @Sendable (_ configurationJSON: UnsafeRawBufferPointer?, _ recordHandler: @escaping @Sendable (_ recordJSON: UnsafeRawBufferPointer) -> Void) async throws -> Bool
@_extern(c, "swt_abiv0_getEntryPoint")
func swt_abiv0_getEntryPoint() -> UnsafeRawPointer
@main struct Runner {
static func main() async throws {
nonisolated(unsafe) let configurationJSON: UnsafeRawBufferPointer? = nil
let recordHandler: @Sendable (UnsafeRawBufferPointer) -> Void = { _ in }
let entryPoint = unsafeBitCast(swt_abiv0_getEntryPoint(), to: EntryPoint.self)
if try await entryPoint(configurationJSON, recordHandler) {
exit(EXIT_SUCCESS)
} else {
exit(EXIT_FAILURE)
}
}
}