Implemented the initialization functions for the DocCMiddleware type in the library target.
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
// ===----------------------------------------------------------------------===
|
||||
//
|
||||
// This source file is part of the Hummingbird DocC Middleware open source project
|
||||
//
|
||||
// Copyright (c) 2025 Röck+Cöde VoF. and the Hummingbird DocC Middleware project authors
|
||||
// Licensed under the EUPL 1.2 or later.
|
||||
//
|
||||
// See LICENSE for license information
|
||||
// See CONTRIBUTORS for the list of Hummingbird DocC Middleware project authors
|
||||
//
|
||||
// ===----------------------------------------------------------------------===
|
||||
|
||||
import Logging
|
||||
import Testing
|
||||
|
||||
extension Logger {
|
||||
|
||||
// MARK: Constants
|
||||
|
||||
/// Creates a logger instance that is ready to use in test cases.
|
||||
static let test: Self = {
|
||||
var logger = Logger(label: "test.hummingbird-docc-middleware.logger")
|
||||
|
||||
logger.logLevel = try! #require(Logger.Level.allCases.randomElement())
|
||||
|
||||
return logger
|
||||
}()
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// ===----------------------------------------------------------------------===
|
||||
//
|
||||
// This source file is part of the Hummingbird DocC Middleware open source project
|
||||
//
|
||||
// Copyright (c) 2025 Röck+Cöde VoF. and the Hummingbird DocC Middleware project authors
|
||||
// Licensed under the EUPL 1.2 or later.
|
||||
//
|
||||
// See LICENSE for license information
|
||||
// See CONTRIBUTORS for the list of Hummingbird DocC Middleware project authors
|
||||
//
|
||||
// ===----------------------------------------------------------------------===
|
||||
|
||||
import Testing
|
||||
|
||||
extension Tag {
|
||||
|
||||
// MARK: Constants
|
||||
|
||||
/// Tag that indicate a test case for a type initialization.
|
||||
@Tag static var initializer: Self
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
// ===----------------------------------------------------------------------===
|
||||
//
|
||||
// This source file is part of the Hummingbird DocC Middleware open source project
|
||||
//
|
||||
// Copyright (c) 2025 Röck+Cöde VoF. and the Hummingbird DocC Middleware project authors
|
||||
// Licensed under the EUPL 1.2 or later.
|
||||
//
|
||||
// See LICENSE for license information
|
||||
// See CONTRIBUTORS for the list of Hummingbird DocC Middleware project authors
|
||||
//
|
||||
// ===----------------------------------------------------------------------===
|
||||
|
||||
import Hummingbird
|
||||
|
||||
/// A stub that conforms to the `FileProvider` protocol.
|
||||
struct FileProviderStub {}
|
||||
|
||||
// MARK: - FileProvider
|
||||
|
||||
extension FileProviderStub: FileProvider {
|
||||
|
||||
// MARK: Type aliases
|
||||
|
||||
typealias FileAttributes = String
|
||||
typealias FileIdentifier = String
|
||||
|
||||
// MARK: Functions
|
||||
|
||||
func getFileIdentifier(_ path: String) -> String? {
|
||||
nil
|
||||
}
|
||||
|
||||
func getAttributes(id: String) async throws -> String? {
|
||||
nil
|
||||
}
|
||||
|
||||
func loadFile(
|
||||
id: String,
|
||||
context: some RequestContext
|
||||
) async throws -> ResponseBody {
|
||||
.init()
|
||||
}
|
||||
|
||||
func loadFile(
|
||||
id: String,
|
||||
range: ClosedRange<Int>,
|
||||
context: some RequestContext
|
||||
) async throws -> ResponseBody {
|
||||
.init()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user