Skip to content

Commit c56dc76

Browse files
committed
Remove @testable annotations where possible
1 parent 7b737e3 commit c56dc76

File tree

5 files changed

+50
-35
lines changed

5 files changed

+50
-35
lines changed

Tests/RegexBuilderTests/RegexDSLTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
import XCTest
1313
import _StringProcessing
14-
@testable import RegexBuilder
14+
import RegexBuilder
1515

1616
class RegexDSLTests: XCTestCase {
1717
func _testDSLCaptures<Content: RegexComponent, MatchType>(
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// This source file is part of the Swift.org open source project
4+
//
5+
// Copyright (c) 2021-2022 Apple Inc. and the Swift project authors
6+
// Licensed under Apache License v2.0 with Runtime Library Exception
7+
//
8+
// See https://swift.org/LICENSE.txt for license information
9+
//
10+
//===----------------------------------------------------------------------===//
11+
12+
@testable import _StringProcessing
13+
import XCTest
14+
15+
// TODO: Protocol-powered testing
16+
extension AlgorithmTests {
17+
func testAdHoc() {
18+
let r = try! Regex("a|b+")
19+
20+
XCTAssert("palindrome".contains(r))
21+
XCTAssert("botany".contains(r))
22+
XCTAssert("antiquing".contains(r))
23+
XCTAssertFalse("cdef".contains(r))
24+
25+
let str = "a string with the letter b in it"
26+
let first = str.firstRange(of: r)
27+
let last = str.lastRange(of: r)
28+
let (expectFirst, expectLast) = (
29+
str.index(atOffset: 0)..<str.index(atOffset: 1),
30+
str.index(atOffset: 25)..<str.index(atOffset: 26))
31+
output(str.split(around: first!))
32+
output(str.split(around: last!))
33+
34+
XCTAssertEqual(expectFirst, first)
35+
XCTAssertEqual(expectLast, last)
36+
37+
XCTAssertEqual(
38+
[expectFirst, expectLast], Array(str.ranges(of: r)))
39+
40+
XCTAssertTrue(str.starts(with: r))
41+
XCTAssertFalse(str.ends(with: r))
42+
43+
XCTAssertEqual(str.dropFirst(), str.trimmingPrefix(r))
44+
XCTAssertEqual("x", "axb".trimming(r))
45+
XCTAssertEqual("x", "axbb".trimming(r))
46+
}
47+
}

Tests/RegexTests/AlgorithmsTests.swift

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//
1010
//===----------------------------------------------------------------------===//
1111

12-
@testable import _StringProcessing
12+
import _StringProcessing
1313
import XCTest
1414

1515
// TODO: Protocol-powered testing
@@ -107,37 +107,6 @@ class RegexConsumerTests: XCTestCase {
107107
expectReplace("aab", "a*", "X", "XXbX")
108108
}
109109

110-
func testAdHoc() {
111-
let r = try! Regex("a|b+")
112-
113-
XCTAssert("palindrome".contains(r))
114-
XCTAssert("botany".contains(r))
115-
XCTAssert("antiquing".contains(r))
116-
XCTAssertFalse("cdef".contains(r))
117-
118-
let str = "a string with the letter b in it"
119-
let first = str.firstRange(of: r)
120-
let last = str.lastRange(of: r)
121-
let (expectFirst, expectLast) = (
122-
str.index(atOffset: 0)..<str.index(atOffset: 1),
123-
str.index(atOffset: 25)..<str.index(atOffset: 26))
124-
output(str.split(around: first!))
125-
output(str.split(around: last!))
126-
127-
XCTAssertEqual(expectFirst, first)
128-
XCTAssertEqual(expectLast, last)
129-
130-
XCTAssertEqual(
131-
[expectFirst, expectLast], Array(str.ranges(of: r)))
132-
133-
XCTAssertTrue(str.starts(with: r))
134-
XCTAssertFalse(str.ends(with: r))
135-
136-
XCTAssertEqual(str.dropFirst(), str.trimmingPrefix(r))
137-
XCTAssertEqual("x", "axb".trimming(r))
138-
XCTAssertEqual("x", "axbb".trimming(r))
139-
}
140-
141110
func testSubstring() throws {
142111
let s = "aaa | aaaaaa | aaaaaaaaaa"
143112
let s1 = s.dropFirst(6) // "aaaaaa | aaaaaaaaaa"

Tests/RegexTests/AllScalarsTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
//===----------------------------------------------------------------------===//
1111

1212
import XCTest
13-
@testable import _StringProcessing
13+
import _StringProcessing
1414

1515
let allScalars = Unicode.Scalar.allScalars
1616

Tests/RegexTests/CompileTests.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
//
1010
//===----------------------------------------------------------------------===//
1111

12-
1312
@testable import _RegexParser
1413
@testable import _StringProcessing
1514

0 commit comments

Comments
 (0)