Skip to content

Commit 9871309

Browse files
committed
1 parent 5f15685 commit 9871309

File tree

1 file changed

+22
-37
lines changed

1 file changed

+22
-37
lines changed

Tests/AppTests/GitLiveTests.swift

Lines changed: 22 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -24,31 +24,29 @@ import Testing
2424
@Suite struct GitLiveTests {
2525

2626
@Test func commitCount() async throws {
27-
try await withGitRepository(defaultDependencies) { path in
28-
let commitCount = try await Git.commitCount(at: path)
29-
#expect(commitCount == 57)
27+
try await withGitRepository(defaultDependencies) { path throws in
28+
#expect(try await Git.commitCount(at: path) == 57)
3029
}
3130
}
3231

3332
@Test func firstCommitDate() async throws {
34-
try await withGitRepository(defaultDependencies) { path in
35-
let firstCommitDate = try await Git.firstCommitDate(at: path)
36-
#expect(firstCommitDate == Date(timeIntervalSince1970: 1426918070)) // Sat, 21 March 2015
33+
try await withGitRepository(defaultDependencies) { path throws in
34+
#expect(try await Git.firstCommitDate(at: path)
35+
== Date(timeIntervalSince1970: 1426918070)) // Sat, 21 March 2015
3736
}
3837
}
3938

4039
@Test func lastCommitDate() async throws {
41-
try await withGitRepository(defaultDependencies) { path in
42-
let lastCommitDate = try await Git.lastCommitDate(at: path)
43-
#expect(lastCommitDate == Date(timeIntervalSince1970: 1554248253)) // Sat, 21 March 2015
40+
try await withGitRepository(defaultDependencies) { path throws in
41+
#expect(try await Git.lastCommitDate(at: path)
42+
== Date(timeIntervalSince1970: 1554248253)) // Sat, 21 March 2015
4443
}
4544
}
4645

4746
@Test func getTags() async throws {
48-
try await withGitRepository(defaultDependencies) { path in
49-
let tags = try await Git.getTags(at: path)
47+
try await withGitRepository(defaultDependencies) { path throws in
5048
#expect(
51-
tags == [
49+
try await Git.getTags(at: path) == [
5250
.tag(0,2,0),
5351
.tag(0,2,1),
5452
.tag(0,2,2),
@@ -74,39 +72,26 @@ import Testing
7472
}
7573

7674
@Test func hasBranch() async throws {
77-
try await withGitRepository(defaultDependencies) { path in
78-
do {
79-
let hasBranch = try await Git.hasBranch(.branch("master"), at: path)
80-
#expect(hasBranch == true)
81-
}
82-
do {
83-
let hasBranch = try await Git.hasBranch(.branch("main"), at: path)
84-
#expect(hasBranch == false)
85-
}
75+
try await withGitRepository(defaultDependencies) { path throws in
76+
#expect(try await Git.hasBranch(.branch("master"), at: path) == true)
77+
#expect(try await Git.hasBranch(.branch("main"), at: path) == false)
8678
}
8779
}
8880

8981
@Test func revisionInfo() async throws {
90-
try await withGitRepository(defaultDependencies) { path in
91-
do {
92-
let revisionInfo = try await Git.revisionInfo(.tag(0,5,2), at: path)
93-
#expect(revisionInfo
94-
== .init(commit: "178566b112afe6bef3770678f1bbab6e5c626993",
95-
date: .init(timeIntervalSince1970: 1554248253)))
96-
}
97-
do {
98-
let revisionInfo = try await Git.revisionInfo(.branch("master"), at: path)
99-
#expect(revisionInfo
100-
== .init(commit: "178566b112afe6bef3770678f1bbab6e5c626993",
101-
date: .init(timeIntervalSince1970: 1554248253)))
102-
}
82+
try await withGitRepository(defaultDependencies) { path throws in
83+
#expect(try await Git.revisionInfo(.tag(0,5,2), at: path)
84+
== .init(commit: "178566b112afe6bef3770678f1bbab6e5c626993",
85+
date: .init(timeIntervalSince1970: 1554248253)))
86+
#expect(try await Git.revisionInfo(.branch("master"), at: path)
87+
== .init(commit: "178566b112afe6bef3770678f1bbab6e5c626993",
88+
date: .init(timeIntervalSince1970: 1554248253)))
10389
}
10490
}
10591

10692
@Test func shortlog() async throws {
107-
try await withGitRepository(defaultDependencies) { path in
108-
let shortlog = try await Git.shortlog(at: path)
109-
#expect(shortlog == """
93+
try await withGitRepository(defaultDependencies) { path throws in
94+
#expect(try await Git.shortlog(at: path) == """
11095
36\tNeil Pankey
11196
21\tJacob Williams
11297
""")

0 commit comments

Comments
 (0)