зеркало из https://github.com/github/libgit2sharp.git
Straighten the building of some test paths
This commit is contained in:
Родитель
15d022261c
Коммит
29df1beb9f
|
@ -175,7 +175,7 @@ namespace LibGit2Sharp.Tests
|
||||||
{
|
{
|
||||||
int count = repo.Index.Count;
|
int count = repo.Index.Count;
|
||||||
|
|
||||||
string filename = "1" + Path.DirectorySeparatorChar + "branch_file.txt";
|
string filename = Path.Combine("1", "branch_file.txt");
|
||||||
const string posixifiedFileName = "1/branch_file.txt";
|
const string posixifiedFileName = "1/branch_file.txt";
|
||||||
ObjectId blobId = repo.Index[posixifiedFileName].Id;
|
ObjectId blobId = repo.Index[posixifiedFileName].Id;
|
||||||
|
|
||||||
|
@ -188,6 +188,7 @@ namespace LibGit2Sharp.Tests
|
||||||
Assert.NotEqual((blobId), repo.Index[posixifiedFileName].Id);
|
Assert.NotEqual((blobId), repo.Index[posixifiedFileName].Id);
|
||||||
|
|
||||||
repo.Index.Unstage(posixifiedFileName);
|
repo.Index.Unstage(posixifiedFileName);
|
||||||
|
|
||||||
Assert.Equal(count, repo.Index.Count);
|
Assert.Equal(count, repo.Index.Count);
|
||||||
Assert.Equal(blobId, repo.Index[posixifiedFileName].Id);
|
Assert.Equal(blobId, repo.Index[posixifiedFileName].Id);
|
||||||
}
|
}
|
||||||
|
@ -250,7 +251,7 @@ namespace LibGit2Sharp.Tests
|
||||||
int count = repo.Index.Count;
|
int count = repo.Index.Count;
|
||||||
|
|
||||||
DirectoryInfo di = Directory.CreateDirectory(Path.Combine(repo.Info.WorkingDirectory, "Project"));
|
DirectoryInfo di = Directory.CreateDirectory(Path.Combine(repo.Info.WorkingDirectory, "Project"));
|
||||||
string file = "Project" + Path.DirectorySeparatorChar + "a_file.txt";
|
string file = Path.Combine("Project", "a_file.txt");
|
||||||
|
|
||||||
File.WriteAllText(Path.Combine(di.FullName, "a_file.txt"), "With backward slash on Windows!");
|
File.WriteAllText(Path.Combine(di.FullName, "a_file.txt"), "With backward slash on Windows!");
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ namespace LibGit2Sharp.Tests
|
||||||
|
|
||||||
RepositoryStatus newStatus = repo.Index.RetrieveStatus();
|
RepositoryStatus newStatus = repo.Index.RetrieveStatus();
|
||||||
|
|
||||||
var expected = new[] { "1.txt", "1" + Path.DirectorySeparatorChar + "branch_file.txt", "deleted_staged_file.txt",
|
var expected = new[] { "1.txt", Path.Combine("1", "branch_file.txt"), "deleted_staged_file.txt",
|
||||||
"deleted_unstaged_file.txt", "modified_staged_file.txt", "modified_unstaged_file.txt" };
|
"deleted_unstaged_file.txt", "modified_staged_file.txt", "modified_unstaged_file.txt" };
|
||||||
|
|
||||||
Assert.Equal(expected.Length, newStatus.Where(IsStaged).Count());
|
Assert.Equal(expected.Length, newStatus.Where(IsStaged).Count());
|
||||||
|
|
|
@ -120,8 +120,7 @@ namespace LibGit2Sharp.Tests
|
||||||
Assert.Equal(1, repoStatus.Count());
|
Assert.Equal(1, repoStatus.Count());
|
||||||
StatusEntry statusEntry = repoStatus.Single();
|
StatusEntry statusEntry = repoStatus.Single();
|
||||||
|
|
||||||
string expectedPath = string.Format("{0}{1}{2}", directoryName, Path.DirectorySeparatorChar, fileName);
|
Assert.Equal(Path.Combine(directoryName, fileName), statusEntry.FilePath);
|
||||||
Assert.Equal(expectedPath, statusEntry.FilePath);
|
|
||||||
|
|
||||||
Assert.Equal(statusEntry.FilePath, repoStatus.Added.Single());
|
Assert.Equal(statusEntry.FilePath, repoStatus.Added.Single());
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,7 +154,7 @@ namespace LibGit2Sharp.Tests
|
||||||
TreeEntry treeTreeEntry = commitTree["1"];
|
TreeEntry treeTreeEntry = commitTree["1"];
|
||||||
Assert.Equal("1", treeTreeEntry.Path);
|
Assert.Equal("1", treeTreeEntry.Path);
|
||||||
|
|
||||||
string completePath = "1" + Path.DirectorySeparatorChar + "branch_file.txt";
|
string completePath = Path.Combine("1", "branch_file.txt");
|
||||||
|
|
||||||
TreeEntry blobTreeEntry = commitTree["1/branch_file.txt"];
|
TreeEntry blobTreeEntry = commitTree["1/branch_file.txt"];
|
||||||
Assert.Equal(completePath, blobTreeEntry.Path);
|
Assert.Equal(completePath, blobTreeEntry.Path);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче