restores Helder in all its glory
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import Foundation
|
||||
import HelderServices
|
||||
import Testing
|
||||
|
||||
@Suite struct TempGitRepoTests {
|
||||
@Test func createsCommitsAndCleansUp() throws {
|
||||
var repo: TempGitRepo? = try TempGitRepo()
|
||||
let root = try #require(repo?.root)
|
||||
try repo?.commit(["README.md": "hello\n"], message: "first")
|
||||
try repo?.write("README.md", "hello\nworld\n")
|
||||
let status = try repo?.run("status", "--porcelain")
|
||||
#expect(status == " M README.md\n")
|
||||
#expect(try repo?.run("log", "--format=%s") == "first\n")
|
||||
repo = nil
|
||||
#expect(!FileManager.default.fileExists(atPath: root.path))
|
||||
}
|
||||
|
||||
@Test func gitServiceStagesAndCommits() async throws {
|
||||
let repo = try TempGitRepo()
|
||||
try repo.commit(["a.txt": "one\n"])
|
||||
try repo.write("a.txt", "two\n")
|
||||
let service = GitService(root: repo.root)
|
||||
#expect(await service.isRepository())
|
||||
try await service.stage(["a.txt"])
|
||||
#expect(try repo.run("status", "--porcelain") == "M a.txt\n")
|
||||
try await service.unstage(["a.txt"])
|
||||
#expect(try repo.run("status", "--porcelain") == " M a.txt\n")
|
||||
try await service.stage(["a.txt"])
|
||||
try await service.commit(message: "second")
|
||||
#expect(try repo.run("log", "--format=%s") == "second\ncommit\n")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user