// A cover's title never runs past its cover (294 row 6, walker293: a// document's file name, one word with no space, was set on one line out of// its card and over the next card's title).importSwiftUIimport XCTest@testable importCottonUIfinalclassCoverTitleTests: XCTestCase {/// RULE: A file's name breaks between the words its marks join, and is drawn as typed.func testAFilesNameBreaksAtItsMarks() {let name = "Example_Marksheet_2019.pdf" XCTAssertEqual(CoverTitle.breakable(name).replacingOccurrences(of: "\u{200B}", with: ""), name) XCTAssertEqual(CoverTitle.breakable(name).filter { $0 == "\u{200B}" }.count, 3) }/// RULE: A page's head keeps the covers' rule (295 E rule 12): a title wraps to its two lines before it is cut — a file's name with no space may break after each mark that joins its words and is cut after a mark, never mid-word — and plain words are cut at a word, as before.func testAPagesHeadBreaksAndCutsAtTheCoversMarks() {let name = "Example_Invented_Marksheet_Scan_2019_Final.pdf"let named = PaperTitleLines<Text>.candidates(name, wordsConsidered: 60) XCTAssertEqual(named.first, CoverTitle.breakable(name), "the whole name first, breakable at its marks") XCTAssertEqual(named.last?.replacingOccurrences(of: "\u{200B}", with: ""), "Example_\u{2026}") XCTAssertTrue(named.dropFirst().allSatisfy { $0.hasSuffix("\u{2026}") })let words = PaperTitleLines<Text>.candidates("Runway to the invented harbour", wordsConsidered: 60) XCTAssertEqual(words, ["Runway to the invented harbour", "Runway to the invented\u{2026}", "Runway to the\u{2026}", "Runway to\u{2026}", "Runway\u{2026}"]) } #if os(iOS) #endif}