gitbayTests/AccessibilityTests.swift
25 lines · 931 bytes
5 symbols in this file
1import Testing
2@testable import gitbay
3
4struct DiffLineAccessibilityTests {
5
6 @Test func additionReadsNewNumber() {
7 let line = UnifiedDiff.Line(kind: .addition, oldNumber: nil, newNumber: 13, text: "let x = 1")
8 #expect(line.accessibilityLabel == "Added line 13: let x = 1")
9 }
10
11 @Test func deletionReadsOldNumber() {
12 let line = UnifiedDiff.Line(kind: .deletion, oldNumber: 12, newNumber: nil, text: "let x = 0")
13 #expect(line.accessibilityLabel == "Removed line 12: let x = 0")
14 }
15
16 @Test func contextReadsNewNumber() {
17 let line = UnifiedDiff.Line(kind: .context, oldNumber: 11, newNumber: 14, text: "}")
18 #expect(line.accessibilityLabel == "Line 14: }")
19 }
20
21 @Test func blankLineSaysBlank() {
22 let line = UnifiedDiff.Line(kind: .addition, oldNumber: nil, newNumber: 3, text: " ")
23 #expect(line.accessibilityLabel == "Added line 3: blank")
24 }
25}