Skip to content

Commit 7cf89ac

Browse files
author
Devon Stewart
committed
Test for GitAlg diff
1 parent c4527c2 commit 7cf89ac

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

modules/core/src/test/scala/org/scalasteward/core/git/FileGitAlgTest.scala

+17
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,23 @@ class FileGitAlgTest extends FunSuite {
143143
test("version") {
144144
assert(ioGitAlg.version.unsafeRunSync().nonEmpty)
145145
}
146+
147+
test("diff") {
148+
val repo = rootDir / "diff"
149+
val wip = Branch("wip")
150+
val p = for {
151+
_ <- supplement.createRepo(repo)
152+
_ <- ioFileAlg.writeFile(repo / "test.txt", "hello")
153+
_ <- supplement.git("add", "test.txt")(repo)
154+
_ <- ioGitAlg.commitAll(repo, "Add test.txt")
155+
// work on wip
156+
_ <- ioGitAlg.createBranch(repo, wip)
157+
c1 <- ioGitAlg.diff(repo, master)
158+
_ <- ioFileAlg.writeFile(repo / "test.txt", "hello world")
159+
c2 <- ioGitAlg.diff(repo, master)
160+
} yield (c1.isEmpty, c2.isEmpty)
161+
assertEquals(p.unsafeRunSync(), (true, false))
162+
}
146163
}
147164

148165
object FileGitAlgTest {

0 commit comments

Comments
 (0)