зеркало из https://github.com/github/libgit2sharp.git
Check autocrlf in filtered text test
This commit is contained in:
Родитель
0c4780b5fb
Коммит
af11289180
|
@ -23,25 +23,24 @@ namespace LibGit2Sharp.Tests
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[SkippableTheory]
|
||||||
public void CanGetBlobAsFilteredText()
|
[InlineData("false", "hey there\n")]
|
||||||
|
[InlineData("input", "hey there\n")]
|
||||||
|
[InlineData("true", "hey there\r\n")]
|
||||||
|
public void CanGetBlobAsFilteredText(string autocrlf, string expectedText)
|
||||||
{
|
{
|
||||||
using (var repo = new Repository(BareTestRepoPath))
|
SkipIfNotSupported(autocrlf);
|
||||||
|
|
||||||
|
var path = CloneBareTestRepo();
|
||||||
|
using (var repo = new Repository(path))
|
||||||
{
|
{
|
||||||
|
repo.Config.Set("core.autocrlf", autocrlf);
|
||||||
|
|
||||||
var blob = repo.Lookup<Blob>("a8233120f6ad708f843d861ce2b7228ec4e3dec6");
|
var blob = repo.Lookup<Blob>("a8233120f6ad708f843d861ce2b7228ec4e3dec6");
|
||||||
|
|
||||||
var text = blob.GetContentText(new FilteringOptions("foo.txt"));
|
var text = blob.GetContentText(new FilteringOptions("foo.txt"));
|
||||||
|
|
||||||
ConfigurationEntry<bool> autocrlf = repo.Config.Get<bool>("core.autocrlf");
|
Assert.Equal(expectedText, text);
|
||||||
|
|
||||||
if (autocrlf != null && autocrlf.Value)
|
|
||||||
{
|
|
||||||
Assert.Equal("hey there\r\n", text);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Assert.Equal("hey there\n", text);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче