Implemented the "folder" property for the File enumeration in the library target.
This commit is contained in:
parent
5f958c6f4c
commit
6fe45db4f1
@ -26,7 +26,13 @@ extension File {
|
||||
|
||||
var filePath: String {
|
||||
switch self {
|
||||
default: fileName
|
||||
default: folder.path + fileName
|
||||
}
|
||||
}
|
||||
|
||||
var folder: Folder {
|
||||
switch self {
|
||||
default: .root
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,16 @@ struct FileTests {
|
||||
#expect(result == filePath)
|
||||
}
|
||||
|
||||
@Test(arguments: zip(File.allCases, Expectation.folders))
|
||||
func folder(for file: File, expects folder: Folder) async throws {
|
||||
// GIVEN
|
||||
// WHEN
|
||||
let result = file.folder
|
||||
|
||||
// THEN
|
||||
#expect(result == folder)
|
||||
}
|
||||
|
||||
@Test(arguments: zip(File.allCases, Expectation.resourcePaths))
|
||||
func resourcePath(for file: File, expects resourcePath: String) async throws {
|
||||
// GIVEN
|
||||
@ -59,6 +69,16 @@ private extension FileTests {
|
||||
"Package.swift",
|
||||
"README.md"
|
||||
]
|
||||
|
||||
static let folders: [Folder] = [
|
||||
.root,
|
||||
.root,
|
||||
.root,
|
||||
.root,
|
||||
.root,
|
||||
.root
|
||||
]
|
||||
|
||||
|
||||
static let resourcePaths: [String] = [
|
||||
"Resources/Files",
|
||||
|
Loading…
x
Reference in New Issue
Block a user