-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstatus_test.go
41 lines (34 loc) · 846 Bytes
/
status_test.go
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
36
37
38
39
40
41
package lazycommit
import "testing"
// TestNoStagedChanges tests that NoStaged returns true if there are no staged changes, and false otherwise.
func TestNoStagedChanges(t *testing.T) {
t.Log("Creating a new repo.")
dir := tempRepo(t)
repo := Repo(dir)
noStaged, err := repo.NoStaged()
if err != nil {
t.Fatal(err)
}
if !noStaged {
t.Error("expected no staged changes")
}
t.Log("Committing a file so that there's something in the worktree.")
f := commitFile(t, dir, "test.txt", "test")
defer f.Close()
noStaged, err = repo.NoStaged()
if err != nil {
t.Fatal(err)
}
if !noStaged {
t.Error("expected no staged changes")
}
t.Log("Adding a staged file.")
addFile(t, dir, "test2.txt", "test")
noStaged, err = repo.NoStaged()
if err != nil {
t.Fatal(err)
}
if noStaged {
t.Error("expected staged changes")
}
}