Tests/OrgCoreTests/ASCIISearchTests.swift

7e86cdaf6e6806ce6a715f7e497be77ee6260c17
orgstar/Tests/OrgCoreTests/ASCIISearchTests.swift

15 lines · 675 bytes

 1import Foundation
 2import Testing
 3@testable import OrgCore
 4
 5struct ASCIISearchTests {
 6    @Test func matchesCaseInsensitiveRangeOf() {
 7        let texts = ["", "#+SETUPFILE: x", "a\n#+SetupFile:y", "#+setupfil", "é #+setupfile:", "##+setupfile:", "[CITE:@a]", "x[cit"]
 8        for text in texts {
 9            for needle in ["#+setupfile:", "[cite", "#+INCLUDE:"] {
10                #expect(text.containsIgnoringASCIICase(needle) == (text.range(of: needle, options: .caseInsensitive) != nil), "\(text) \(needle)")
11                #expect(text[...].containsIgnoringASCIICase(needle) == (text.range(of: needle, options: .caseInsensitive) != nil))
12            }
13        }
14    }
15}
Keyboard shortcuts

Global

⌘K
Command palette & jump
/
Focus search
?
Show this help
g d
Dashboard
g e
Explore repositories
g n
Notifications

Repository & editor

t
Find file in repository
y
Copy immutable SHA permalink
g c
Code tab
g i
Issues tab
g m
Merge requests tab
g b
Builds tab
⌘↵
Submit active form