mirror of
https://github.com/realm/SwiftLint.git
synced 2026-06-06 20:18:40 +00:00
Use variable for system drive
This commit is contained in:
@@ -92,10 +92,12 @@ final class GlobTests: SwiftLintTestCase {
|
||||
func testCreateFilenameMatchers() {
|
||||
func assertGlobMatch(pattern: String, filename: String, file: StaticString = #filePath, line: UInt = #line) {
|
||||
#if os(Windows)
|
||||
var pattern = pattern
|
||||
var filename = filename
|
||||
pattern = "C:" + pattern
|
||||
filename = "C:" + filename
|
||||
guard let driveLetter = ProcessInfo.processInfo.environment["SystemDrive"] else {
|
||||
XCTFail("Cannot retrieve %SystemDrive% environment variable")
|
||||
return
|
||||
}
|
||||
var pattern = driveLetter + pattern
|
||||
var filename = driveLetter + filename
|
||||
#endif
|
||||
let matchers = Glob.createFilenameMatchers(pattern: pattern)
|
||||
XCTAssert(matchers.anyMatch(filename: filename), file: file, line: line)
|
||||
|
||||
Reference in New Issue
Block a user