From f954871968ca6df54aab26d6984cc42bb3904ef2 Mon Sep 17 00:00:00 2001 From: Ben Navetta Date: Mon, 18 Aug 2014 22:19:06 -0400 Subject: start on status tests; fix bug in Repository.StatusList() --- status_test.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 status_test.go (limited to 'status_test.go') diff --git a/status_test.go b/status_test.go new file mode 100644 index 0000000..0cc9de3 --- /dev/null +++ b/status_test.go @@ -0,0 +1,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() + checkFatal(t, err) + + entryCount, err := statusList.EntryCount() + checkFatal(t, err) + + if entryCount != 1 { + t.Fatal("Incorrect number of status entries: ", entryCount) + } +} -- cgit v1.2.3