Cotton code
36 lines · 1.7 KB · SwiftRaw
import XCTest@testable import CottonUI/// The fan has no band: the shell's one ground shows between its objects.final class FanBandTests: XCTestCase {    private func code(_ path: String) throws -> String {        SourceSweep.withoutComments(try SourceSweep.mustRead("apps/cotton/Sources/CottonUI/" + path, ownedBy: "fan ground"))    }    func testOnlyTheShellPaintsTheDeckGround() throws {        let host = try code("Boot/StackHost.swift")        XCTAssertEqual(host.components(separatedBy: "DeckGroundLaid(").count - 1, 1)        XCTAssertTrue(host.contains("let ground = fanCover.ground"))        XCTAssertTrue(host.contains(".environment(\\.fanLaysGround, navigator.tile == nil)"))        XCTAssertTrue(host.contains("}.ignoresSafeArea()"))        for path in ["Deck/DeckSurface.swift", "Surfaces/BoardSurface.swift", "Surfaces/Board/FanSurface.swift"] {            XCTAssertFalse(try code(path).contains("DeckGroundLaid("), path)        }    }    func testTheFanAndMicrophoneHaveNoGroundOrJoinWash() throws {        for path in ["Surfaces/Board/FanSurface.swift", "Surfaces/Board/PageFoot.swift", "Surfaces/HomeInput.swift"] {            let source = try code(path)            XCTAssertFalse(source.contains("PageGroundFill("), path)            XCTAssertFalse(source.contains("LinearGradient("), path)        }        let fan = try code("Surfaces/Board/FanSurface.swift")        XCTAssertFalse(fan.contains(".cottonPageGround("))    }    func testPagesLeaveTheWindowGroundBare() throws {        for path in ["Deck/CardDeck.swift", "Deck/DeckSurface.swift", "Paper/PaperScreen.swift"] {            XCTAssertFalse(try code(path).contains("PageGroundFill("), path)        }    }}