Skip to content

Commit df4b912

Browse files
authored
Merge pull request #340 from cltnschlosser/cs_VirtualPathDebugDescription
Add VirtualPath conformance to CustomDebugStringConvertable. Makes unit test failures easier to work with
2 parents c10fb27 + c66811e commit df4b912

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

Sources/SwiftDriver/Utilities/VirtualPath.swift

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,27 @@ extension VirtualPath: CustomStringConvertible {
304304
}
305305
}
306306

307+
extension VirtualPath: CustomDebugStringConvertible {
308+
public var debugDescription: String {
309+
switch self {
310+
case .relative(let path):
311+
return ".relative(\(path.pathString))"
312+
case .absolute(let path):
313+
return ".absolute(\(path.pathString))"
314+
case .standardInput:
315+
return ".standardInput"
316+
case .standardOutput:
317+
return ".standardOutput"
318+
case .temporary(let path):
319+
return ".temporary(\(path.pathString))"
320+
case .temporaryWithKnownContents(let path, _):
321+
return ".temporaryWithKnownContents(\(path.pathString))"
322+
case .fileList(let path, _):
323+
return ".fileList(\(path.pathString))"
324+
}
325+
}
326+
}
327+
307328
extension VirtualPath {
308329
/// Replace the extension of the given path with a new one based on the
309330
/// specified file type.

0 commit comments

Comments
 (0)