summaryrefslogtreecommitdiff
path: root/status_test.go
blob: 3fababee84a670c36a2db2d2fed3fccd9a115588 (plain)
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
package git

import (
	"io/ioutil"
	"os"
	"path"
	"testing"
)

func TestEntryCount(t *testing.T) {
	repo := createTestRepo(t)
	defer repo.Free()
	defer os.RemoveAll(repo.Workdir())

	err := ioutil.WriteFile(path.Join(path.Dir(repo.Path()), "hello.txt"), []byte("Hello, World"), 0644)
	checkFatal(t, err)

	statusList, err := repo.StatusList(nil)
	checkFatal(t, err)

	entryCount, err := statusList.EntryCount()
	checkFatal(t, err)

	if entryCount != 1 {
		t.Fatal("Incorrect number of status entries: ", entryCount)
	}
}