summaryrefslogtreecommitdiff
path: root/status_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'status_test.go')
-rw-r--r--status_test.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/status_test.go b/status_test.go
index 17ed94f..d5cd530 100644
--- a/status_test.go
+++ b/status_test.go
@@ -61,3 +61,31 @@ func TestStatusList(t *testing.T) {
t.Fatal("Incorrect entry path: ", entry.IndexToWorkdir.NewFile.Path)
}
}
+
+func TestStatusNothing(t *testing.T) {
+ t.Parallel()
+ repo := createTestRepo(t)
+ defer cleanupTestRepo(t, repo)
+
+ seedTestRepo(t, repo)
+
+ opts := &StatusOptions{
+ Show: StatusShowIndexAndWorkdir,
+ Flags: StatusOptIncludeUntracked | StatusOptRenamesHeadToIndex | StatusOptSortCaseSensitively,
+ }
+
+ statusList, err := repo.StatusList(opts)
+ checkFatal(t, err)
+
+ entryCount, err := statusList.EntryCount()
+ checkFatal(t, err)
+
+ if entryCount != 0 {
+ t.Fatal("expected no statuses in empty repo")
+ }
+
+ _, err = statusList.ByIndex(0)
+ if err == nil {
+ t.Error("expected error getting status by index")
+ }
+}