Regular Expressions 101

Community Patterns

Test for occurrences of XCTest @testable annotation usage

0

Regular Expression
PCRE (PHP <7.3)

/
^[\s]*@testable[\s]*import[\s]*\w
/
gmi

Description

There may be circumstances when you need to determine if there is any usage of XCTest's @testable annotation in unit test cases.

One usage of this regex could be for a custom SwiftLint rule to require or disallow usage of @testable

Submitted by anonymous - 4 years ago