Cotton code
22 lines · 881 B · SwiftRaw
// Test-only fixtures: the bundled resources.// The shipping root's tables are the core's (`AppTables.core`);// `RootRecordsGuardTests` keeps fixtures out of `Sources`.import Foundation@testable import CottonUI/// The package's resource bundle: the built one this build found, else the/// one built beside this test bundle (a package that depends on CottonUI by/// path), else the tree's `Resources` directory.enum TestResources {    private final class Marker {}    static func bundle() throws -> Bundle {        if let built = CottonUIResources.bundle { return built }        if let beside = CottonUIResources.locate(from: Bundle(for: Marker.self)) { return beside }        guard let tree = Bundle(url: SourceSweep.iosSources.appendingPathComponent("CottonUI/Resources")) else {            throw CocoaError(.fileNoSuchFile)        }        return tree    }}