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}