Cotton code
41 lines · 1.5 KB · SwiftRaw
// The slip-list tile: which records a tile shows, and in what order. Every// record is invented.import CottonKitimport CottonValuesimport Foundationimport XCTest@testable import CottonUIfinal class SlipTileTests: XCTestCase {    private static var resources: Bundle? {        Bundle(url: SourceSweep.iosSources.appendingPathComponent("CottonUI/Resources"))    }    private func todos() throws -> TableDefinition {        let loaded = FixtureDefinitions.load(from: try XCTUnwrap(Self.resources))        return try XCTUnwrap(loaded.definitions.first { $0.id == "todo" })    }    private var ist: Calendar {        var out = Calendar(identifier: .gregorian)        out.timeZone = TimeZone(identifier: "Asia/Kolkata")!        out.locale = Locale(identifier: "en_US_POSIX")        return out    }    /// Thursday 1 October 2026, ten in the morning in Kolkata.    private var now: Date { CottonDate.parse("2026-10-01T10:00:00+05:30", calendar: ist)! }    private func todo(_ id: String, _ title: String = "Example", due: String? = nil, status: String = "open") -> TableRecord {        var values: [String: RecordValue] = ["title": .text(title), "status": .text(status)]        if let due { values["due_at"] = .text(due) }        return TableRecord(id: "example-\(id)", values: values)    }    // ── Which, and in what words ────────────────────────────────────────}