forked from yonaskolb/XcodeGen
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInvalidConfigsFormatTests.swift
More file actions
35 lines (30 loc) · 1.08 KB
/
InvalidConfigsFormatTests.swift
File metadata and controls
35 lines (30 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import ProjectSpec
import Testing
import TestSupport
import PathKit
struct invalidConfigsMappingFormatTests {
@Test("throws invalidConfigsMappingFormat error for non-dictionary configs entries")
func testNonDictionaryConfigsEntries() throws {
let path = fixturePath + "invalid_configs_value_non_mapping.yml"
let expectedError = SpecParsingError.invalidConfigsMappingFormat(keys: ["invalid_key0", "invalid_key1"])
#expect(throws: EquatableErrorBox(expectedError)) {
try perform(path: path)
}
}
private func perform(path: Path) throws {
do {
_ = try Project(path: path)
} catch let error as SpecParsingError {
throw EquatableErrorBox(error)
} catch {
throw error
}
}
// SpecParsingError does not conform to Equatable, so we wrap its description here
private struct EquatableErrorBox: Error, Equatable {
let description: String
init<E: Error & CustomStringConvertible>(_ error: E) {
self.description = error.description
}
}
}