Skip to content

Commit

Permalink
Prove that libgit2#379 is fixed in libgit2
Browse files Browse the repository at this point in the history
  • Loading branch information
dahlbyk committed Aug 19, 2013
1 parent bfd1564 commit e296563
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 4 deletions.
9 changes: 5 additions & 4 deletions LibGit2Sharp.Tests/StageFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,15 @@ public void CanStageTheRemovalOfAStagedFile()
}
}

[Fact]
public void CanStageANewFileInAPersistentManner()
[Theory]
[InlineData("unit_test.txt")]
[InlineData("!unit_test.txt")]
[InlineData("!bang/unit_test.txt")]
public void CanStageANewFileInAPersistentManner(string filename)
{
string path = CloneStandardTestRepo();
using (var repo = new Repository(path))
{
const string filename = "unit_test.txt";
Assert.Equal(FileStatus.Nonexistent, repo.Index.RetrieveStatus(filename));
Assert.Null(repo.Index[filename]);

Expand All @@ -147,7 +149,6 @@ public void CanStageANewFileInAPersistentManner()

using (var repo = new Repository(path))
{
const string filename = "unit_test.txt";
Assert.NotNull(repo.Index[filename]);
Assert.Equal(FileStatus.Added, repo.Index.RetrieveStatus(filename));
}
Expand Down
36 changes: 36 additions & 0 deletions LibGit2Sharp.Tests/StatusFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,42 @@ public void CanRetrieveTheStatusOfAFile()
}
}

[Theory]
[InlineData("file")]
[InlineData("file.txt")]
[InlineData("$file")]
[InlineData("$file.txt")]
[InlineData("$dir/file")]
[InlineData("$dir/file.txt")]
[InlineData("#file")]
[InlineData("#file.txt")]
[InlineData("#dir/file")]
[InlineData("#dir/file.txt")]
[InlineData("^file")]
[InlineData("^file.txt")]
[InlineData("^dir/file")]
[InlineData("^dir/file.txt")]
[InlineData("!file")]
[InlineData("!file.txt")]
[InlineData("!dir/file")]
[InlineData("!dir/file.txt")]
[InlineData("file!")]
[InlineData("file!.txt")]
[InlineData("dir!/file")]
[InlineData("dir!/file.txt")]
public void CanRetrieveTheStatusOfAnUntrackedFile(string filePath)
{
var clone = CloneStandardTestRepo();

using (var repo = new Repository(clone))
{
Touch(repo.Info.WorkingDirectory, filePath, "content");

FileStatus status = repo.Index.RetrieveStatus(filePath);
Assert.Equal(FileStatus.Untracked, status);
}
}

[Fact]
public void RetrievingTheStatusOfADirectoryThrows()
{
Expand Down

0 comments on commit e296563

Please sign in to comment.