Skip to content

Commit 12a8c9b

Browse files
committed
...
1 parent a243f60 commit 12a8c9b

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

Sources/_StringProcessing/Regex/DSLTree.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,7 @@ extension DSLTree.Node {
724724
/// In particular, non-required groups and option-setting groups are
725725
/// inconclusive about where they can match.
726726
private func _canOnlyMatchAtStartImpl(_ options: inout MatchingOptions) -> Bool? {
727+
print(self)
727728
switch self {
728729
// Defining cases
729730
case .atom(.assertion(.startOfSubject)):

Tests/RegexBuilderTests/RegexDSLTests.swift

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -984,28 +984,29 @@ class RegexDSLTests: XCTestCase {
984984
@RegexComponentBuilder _ content: () -> some RegexComponent
985985
) {
986986
let regex = content().regex
987+
let result = regex.program.loweredProgram.canOnlyMatchAtStart
987988
print("""
988-
canOnlyMatchAtStart: \(regex.program.loweredProgram.canOnlyMatchAtStart)
989+
canOnlyMatchAtStart: \(result)
989990
expectation: \(expectation)
990-
equal? \(regex.program.loweredProgram.canOnlyMatchAtStart == expectation)
991+
equal? \(result == expectation)
991992
""")
992993

994+
XCTAssertEqual(result ? 1 : 0, expectation ? 1 : 0, file: file, line: line)
995+
993996
if expectation {
994-
XCTAssertTrue(regex.program.loweredProgram.canOnlyMatchAtStart, file: file, line: line)
997+
XCTAssertTrue(result, file: file, line: line)
995998
} else {
996-
XCTAssertFalse(regex.program.loweredProgram.canOnlyMatchAtStart, file: file, line: line)
999+
XCTAssertFalse(result, file: file, line: line)
9971000
}
9981001

999-
XCTAssertTrue(expectation == regex.program.loweredProgram.canOnlyMatchAtStart, file: file, line: line)
1002+
XCTAssertTrue(expectation == result, file: file, line: line)
10001003

1001-
XCTAssertEqual(regex.program.loweredProgram.canOnlyMatchAtStart, expectation, file: file, line: line)
1004+
XCTAssertEqual(result, expectation, file: file, line: line)
10021005
XCTAssertEqual(
1003-
regex.program.loweredProgram.canOnlyMatchAtStart.baseValue,
1006+
result.baseValue,
10041007
expectation.baseValue,
10051008
file: file, line: line)
1006-
print(
1007-
regex.program.loweredProgram.canOnlyMatchAtStart.baseValue,
1008-
expectation.baseValue)
1009+
fflush(stdout)
10091010
}
10101011

10111012
expectCanOnlyMatchAtStart(true) {

0 commit comments

Comments
 (0)