diff options
| author | Ben Navetta <[email protected]> | 2014-08-19 08:51:18 -0400 |
|---|---|---|
| committer | Ben Navetta <[email protected]> | 2014-08-19 08:51:18 -0400 |
| commit | 1cb654e4f2ae536f71773dbe0bd808874b832d9c (patch) | |
| tree | aa5f387735b6db75ed1b9ae8e52c3ba436fd4557 /status_test.go | |
| parent | fe1e6b83edfa8456f6ed8eb83eaa6fe57771e875 (diff) | |
add git_status_foreach binding
Diffstat (limited to 'status_test.go')
| -rw-r--r-- | status_test.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/status_test.go b/status_test.go index 228ee0e..a0ff1d3 100644 --- a/status_test.go +++ b/status_test.go @@ -23,6 +23,29 @@ func TestStatusFile(t *testing.T) { } } +func TestStatusForeach(t *testing.T) { + repo := createTestRepo(t) + defer repo.Free() + defer os.RemoveAll(repo.Workdir()) + + err := ioutil.WriteFile(path.Join(path.Dir(repo.Workdir()), "hello.txt"), []byte("Hello, World"), 0644) + checkFatal(t, err) + + statusFound := false + err = repo.StatusForeach(func (path string, statusFlags Status) int { + if path == "hello.txt" && statusFlags & StatusWtNew != 0 { + statusFound = true + } + + return 0 + }); + checkFatal(t, err) + + if !statusFound { + t.Fatal("Status callback not called with the new file") + } +} + func TestEntryCount(t *testing.T) { repo := createTestRepo(t) defer repo.Free() |
