From af112891809fddb14705cb751f5217ee6b9cd990 Mon Sep 17 00:00:00 2001 From: Keith Dahlby Date: Thu, 24 Oct 2013 14:21:17 -0500 Subject: [PATCH] Check autocrlf in filtered text test --- LibGit2Sharp.Tests/BlobFixture.cs | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/LibGit2Sharp.Tests/BlobFixture.cs b/LibGit2Sharp.Tests/BlobFixture.cs index cc9d2041..24f5d0b7 100644 --- a/LibGit2Sharp.Tests/BlobFixture.cs +++ b/LibGit2Sharp.Tests/BlobFixture.cs @@ -23,25 +23,24 @@ namespace LibGit2Sharp.Tests } } - [Fact] - public void CanGetBlobAsFilteredText() + [SkippableTheory] + [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("a8233120f6ad708f843d861ce2b7228ec4e3dec6"); var text = blob.GetContentText(new FilteringOptions("foo.txt")); - ConfigurationEntry autocrlf = repo.Config.Get("core.autocrlf"); - - if (autocrlf != null && autocrlf.Value) - { - Assert.Equal("hey there\r\n", text); - } - else - { - Assert.Equal("hey there\n", text); - } + Assert.Equal(expectedText, text); } }