Skip to content

Commit 782eac3

Browse files
artyom-razinovAvito iOSBot
authored andcommitted
MBS-13386: Implement scanning resolves for two cases
`container.resolve()` and `container.lazilyResolve()` is scanned when used as arguments of a constructor Fixture module was created to test it Xcodebuild wasn't implemented (tested) yet GitOrigin-RevId: 459073ac74b5c0bb6b4b4f1d05e3bc5c7bf3dcb0
1 parent 4ae1606 commit 782eac3

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

Sources/FileSystem/File/WorkingWithContents/DataWriter/DataWriter.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,16 @@ extension DataWriter {
3232
ensureDirectoryExists: ensureDirectoryExists
3333
)
3434
}
35+
36+
public func writeJson<T: Encodable>(
37+
encodable: T,
38+
filePath: AbsolutePath,
39+
ensureDirectoryExists: Bool = true
40+
) throws {
41+
try write(
42+
data: JSONEncoder().encode(encodable),
43+
filePath: filePath,
44+
ensureDirectoryExists: ensureDirectoryExists
45+
)
46+
}
3547
}

Sources/FileSystem/File/WorkingWithContents/FileReader/FileReader.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,13 @@ extension FileReader {
1010
public func string(filePath: AbsolutePath) throws -> String {
1111
return try String(utf8Data: contents(filePath: filePath))
1212
}
13+
14+
public func decodable<T: Decodable>(
15+
jsonFilePath: AbsolutePath
16+
) throws -> T {
17+
return try JSONDecoder().decode(
18+
T.self,
19+
from: contents(filePath: jsonFilePath)
20+
)
21+
}
1322
}

0 commit comments

Comments
 (0)