Skip to content

Commit c672069

Browse files
committed
Fix tests
1 parent 23696c7 commit c672069

File tree

7 files changed

+65
-65
lines changed

7 files changed

+65
-65
lines changed

Tests/XcodeProjTests/Objects/Project/PBXProjIntegrationTests.swift

+6-6
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ final class PBXProjIntegrationTests: XCTestCase {
1616

1717
func test_write() throws {
1818
try testWrite(from: fixturePath(),
19-
initModel: { path -> PBXProj? in
20-
let data = try XCTUnwrap(Data(contentsOf: path.url))
21-
let decoder = XcodeprojPropertyListDecoder()
22-
return try? decoder.decode(PBXProj.self, from: data)
23-
},
24-
modify: { $0 })
19+
initModel: { path -> PBXProj? in
20+
let data = try XCTUnwrap(Data(contentsOf: path.url))
21+
let decoder = XcodeprojPropertyListDecoder()
22+
return try? decoder.decode(PBXProj.self, from: data)
23+
},
24+
modify: { $0 })
2525
}
2626

2727
func test_write_produces_no_diff() throws {

Tests/XcodeProjTests/Project/XCBreakpointListTests.swift

+5-5
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ final class XCBreakpointListIntegrationTests: XCTestCase {
1717
}
1818
}
1919

20-
func test_write() {
21-
testWrite(from: fixturePath(),
22-
initModel: { try? XCBreakpointList(path: $0) },
23-
modify: { $0 },
24-
assertion: { assert(breakpointList: $1) })
20+
func test_write() throws {
21+
try testWrite(from: fixturePath(),
22+
initModel: { try? XCBreakpointList(path: $0) },
23+
modify: { $0 },
24+
assertion: { assert(breakpointList: $1) })
2525
}
2626

2727
// MARK: - Private

Tests/XcodeProjTests/Project/XCUserDataTests.swift

+11-11
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ final class XCUserDataTests: XCTestCase {
99
assert(userData: subject, userName: "username1")
1010
}
1111

12-
func test_write_userData() {
13-
testWrite(from: userDataPath,
14-
initModel: { try? XCUserData(path: $0) },
15-
modify: { userData in
16-
// XCScheme's that are already in place (the removed element) should not be removed by a write
17-
userData.schemes = userData.schemes.filter { $0.name != "iOS-other" }
18-
return userData
19-
},
20-
assertion: {
21-
assert(userData: $1, userName: "copy")
22-
})
12+
func test_write_userData() throws {
13+
try testWrite(from: userDataPath,
14+
initModel: { try? XCUserData(path: $0) },
15+
modify: { userData in
16+
// XCScheme's that are already in place (the removed element) should not be removed by a write
17+
userData.schemes = userData.schemes.filter { $0.name != "iOS-other" }
18+
return userData
19+
},
20+
assertion: {
21+
assert(userData: $1, userName: "copy")
22+
})
2323
}
2424

2525
func test_read_write_produces_no_diff() throws {

Tests/XcodeProjTests/Project/XcodeProjIntegrationTests.swift

+22-22
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ final class XcodeProjIntegrationTests: XCTestCase {
1414
assert(project: subject)
1515
}
1616

17-
func test_write_iosXcodeProj() {
18-
testWrite(from: iosProjectPath,
19-
initModel: { try? XcodeProj(path: $0) },
20-
modify: { project in
21-
// XCUserData that is already in place (the removed element) should not be removed by a write
22-
_ = project.userData.removeLast()
23-
return project
24-
},
25-
assertion: { assert(project: $1) })
17+
func test_write_iosXcodeProj() throws {
18+
try testWrite(from: iosProjectPath,
19+
initModel: { try? XcodeProj(path: $0) },
20+
modify: { project in
21+
// XCUserData that is already in place (the removed element) should not be removed by a write
22+
_ = project.userData.removeLast()
23+
return project
24+
},
25+
assertion: { assert(project: $1) })
2626
}
2727

2828
func test_read_write_produces_no_diff() throws {
@@ -53,19 +53,19 @@ final class XcodeProjIntegrationTests: XCTestCase {
5353
// Define workspace settings that should be written
5454
let workspaceSettings = WorkspaceSettings(buildSystem: .new, derivedDataLocationStyle: .default, autoCreateSchemes: false)
5555

56-
testWrite(from: iosProjectPath,
57-
initModel: { try? XcodeProj(path: $0) },
58-
modify: { project in
59-
project.sharedData?.workspaceSettings = workspaceSettings
60-
return project
61-
},
62-
assertion: {
63-
/**
64-
* Expect that the workspace settings read from file are equal to the
65-
* workspace settings we expected to write.
66-
*/
67-
XCTAssertEqual($1.sharedData?.workspaceSettings, workspaceSettings)
68-
})
56+
try testWrite(from: iosProjectPath,
57+
initModel: { try? XcodeProj(path: $0) },
58+
modify: { project in
59+
project.sharedData?.workspaceSettings = workspaceSettings
60+
return project
61+
},
62+
assertion: {
63+
/**
64+
* Expect that the workspace settings read from file are equal to the
65+
* workspace settings we expected to write.
66+
*/
67+
XCTAssertEqual($1.sharedData?.workspaceSettings, workspaceSettings)
68+
})
6969
}
7070

7171
// MARK: - Private

Tests/XcodeProjTests/Scheme/XCSchemeTests.swift

+15-15
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ final class XCSchemeIntegrationTests: XCTestCase {
99
assert(scheme: subject)
1010
}
1111

12-
func test_write_iosScheme() {
13-
testWrite(from: iosSchemePath,
14-
initModel: { try? XCScheme(path: $0) },
15-
modify: { $0 },
16-
assertion: { assert(scheme: $1) })
12+
func test_write_iosScheme() throws {
13+
try testWrite(from: iosSchemePath,
14+
initModel: { try? XCScheme(path: $0) },
15+
modify: { $0 },
16+
assertion: { assert(scheme: $1) })
1717
}
1818

1919
func test_read_write_produces_no_diff() throws {
@@ -42,11 +42,11 @@ final class XCSchemeIntegrationTests: XCTestCase {
4242
XCTAssertEqual(remoteRunnable.remotePath, "/var/containers/Bundle/Application/018F0933-05E8-4359-9955-39E0523C4246/Ava.app")
4343
}
4444

45-
func test_write_runnableWithoutBuildableReferenceScheme() {
46-
testWrite(from: runnableWithoutBuildableReferenceSchemePath,
47-
initModel: { try? XCScheme(path: $0) },
48-
modify: { $0 },
49-
assertion: { assert(runnableWithoutBuildableReferenceScheme: $1) })
45+
func test_write_runnableWithoutBuildableReferenceScheme() throws {
46+
try testWrite(from: runnableWithoutBuildableReferenceSchemePath,
47+
initModel: { try? XCScheme(path: $0) },
48+
modify: { $0 },
49+
assertion: { assert(runnableWithoutBuildableReferenceScheme: $1) })
5050
}
5151

5252
func test_read_minimalScheme() {
@@ -58,11 +58,11 @@ final class XCSchemeIntegrationTests: XCTestCase {
5858
}
5959
}
6060

61-
func test_write_minimalScheme() {
62-
testWrite(from: minimalSchemePath,
63-
initModel: { try? XCScheme(path: $0) },
64-
modify: { $0 },
65-
assertion: { assert(minimalScheme: $1) })
61+
func test_write_minimalScheme() throws {
62+
try testWrite(from: minimalSchemePath,
63+
initModel: { try? XCScheme(path: $0) },
64+
modify: { $0 },
65+
assertion: { assert(minimalScheme: $1) })
6666
}
6767

6868
func test_write_testableReferenceDefaultAttributesValuesAreOmitted() {

Tests/XcodeProjTests/Utils/XCConfigTests.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,10 @@ final class XCConfigIntegrationTests: XCTestCase {
8686
}
8787
}
8888

89-
func test_write_writesTheContentProperly() {
90-
testWrite(from: childrenPath(),
91-
initModel: { try? XCConfig(path: $0) },
92-
modify: { $0 })
89+
func test_write_writesTheContentProperly() throws {
90+
try testWrite(from: childrenPath(),
91+
initModel: { try? XCConfig(path: $0) },
92+
modify: { $0 })
9393
}
9494

9595
private func childrenPath() -> Path {

Tests/XcodeProjTests/Workspace/XCWorkspaceDataTests.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ final class XCWorkspaceDataIntegrationTests: XCTestCase {
3939
} catch {}
4040
}
4141

42-
func test_write() {
43-
testWrite(
42+
func test_write() throws {
43+
try testWrite(
4444
from: fixturePath(),
4545
initModel: { try? XCWorkspaceData(path: $0) },
4646
modify: {

0 commit comments

Comments
 (0)