@@ -34,7 +34,7 @@ func TestOpenRepoError(t *testing.T) {
3434}
3535
3636// Tests that NoStaged returns true if there are no staged changes.
37- func TestNoStaged (t * testing.T ) {
37+ func TestNoStagedChanges (t * testing.T ) {
3838 dir := tempRepo (t )
3939 // NOTE: Committing a file so that there's something in the worktree.
4040 f := commitFile (t , dir , "test.txt" , "test" )
@@ -57,6 +57,27 @@ func TestNoStaged(t *testing.T) {
5757 }
5858}
5959
60+ // Tests that NoStaged returns true if there new files are not staged.
61+ func TestNoStagedNewFiles (t * testing.T ) {
62+ dir := tempRepo (t )
63+ // NOTE: Committing a file so that there's something in the worktree.
64+ commitFile (t , dir , "test.txt" , "test" )
65+ writeFile (t , dir , "test2.txt" , "test" )
66+
67+ repo , err := OpenRepo (dir )
68+ if err != nil {
69+ t .Fatal (err )
70+ }
71+ noStaged , err := repo .NoStaged ()
72+ if err != nil {
73+ t .Fatal (err )
74+ }
75+ if ! noStaged {
76+ t .Logf ("status: %v" , getStatus (t , dir ))
77+ t .Fatal ("expected no staged changes" )
78+ }
79+ }
80+
6081// Tests that NoStaged returns false if there are staged changes.
6182func TestNoStagedStaged (t * testing.T ) {
6283 dir := tempRepo (t )
0 commit comments