8000 Updates for .NET 8 by bording · Pull Request #2085 · libgit2/libgit2sharp · GitHub
[go: up one dir, main page]

Skip to content

Updates for .NET 8 #2085

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Mar 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix test analyzer warnings
  • Loading branch information
bording committed Mar 16, 2024
commit 9e4669c3d95931acb486cda43fab227217d5e258
5 changes: 2 additions & 3 deletions LibGit2Sharp.Tests/BranchFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.Linq;
using LibGit2Sharp.Tests.TestHelpers;
using Xunit;
using Xunit.Extensions;

namespace LibGit2Sharp.Tests
{
Expand Down Expand Up @@ -103,7 +102,7 @@ public void CanCreateAnUnbornBranch()
public void CanCreateBranchUsingAbbreviatedSha()
{
string path = SandboxBareTestRepo();
using (var repo = new Repository(path, new RepositoryOptions{ Identity = Constants.Identity }))
using (var repo = new Repository(path, new RepositoryOptions { Identity = Constants.Identity }))
{
EnableRefLog(repo);

Expand Down Expand Up @@ -1001,7 +1000,7 @@ public void OnlyOneBranchIsTheHead()
continue;
}

Assert.True(false, string.Format("Both '{0}' and '{1}' appear to be Head.", head.CanonicalName, branch.CanonicalName));
Assert.Fail(string.Format("Both '{0}' and '{1}' appear to be Head.", head.CanonicalName, branch.CanonicalName));
}

Assert.NotNull(head);
Expand Down
15 changes: 6 additions & 9 deletions LibGit2Sharp.Tests/FilterFixture.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Threading.Tasks;
using LibGit2Sharp.Tests.TestHelpers;
using Xunit;
using System.Threading.Tasks;

namespace LibGit2Sharp.Tests
{
Expand Down Expand Up @@ -174,7 +173,7 @@ public void CleanFilterWritesOutputToObjectTree()
}

[Fact]
public void CanHandleMultipleSmudgesConcurrently()
public async Task CanHandleMultipleSmudgesConcurrently()
{
const string decodedInput = "This is a substitution cipher";
const string encodedInput = "Guvf vf n fhofgvghgvba pvcure";
Expand All @@ -193,20 +192,18 @@ public void CanHandleMultipleSmudgesConcurrently()

for (int i = 0; i < count; i++)
{
tasks[i] = Task.Factory.StartNew(() =>
tasks[i] = Task.Run(() =>
{
string repoPath = InitNewRepository();
return CheckoutFileForSmudge(repoPath, branchName, encodedInput);
});
}

Task.WaitAll(tasks);
var files = await Task.WhenAll(tasks);

10000 foreach(var task in tasks)
foreach (var file in files)
{
FileInfo expectedFile = task.Result;

string readAllText = File.ReadAllText(expectedFile.FullName);
string readAllText = File.ReadAllText(file.FullName);
Assert.Equal(decodedInput, readAllText);
}
}
Expand Down
8 changes: 4 additions & 4 deletions LibGit2Sharp.Tests/MetaFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public void TypesInLibGit2DecoratedWithDebuggerDisplayMustFollowTheStandardImplP

if (typesWithDebuggerDisplayAndInvalidImplPattern.Any())
{
Assert.True(false, Environment.NewLine + BuildMissingDebuggerDisplayPropertyMessage(typesWithDebuggerDisplayAndInvalidImplPattern));
Assert.Fail(Environment.NewLine + BuildMissingDebuggerDisplayPropertyMessage(typesWithDebuggerDisplayAndInvalidImplPattern));
}
}

Expand Down Expand Up @@ -167,7 +167,7 @@ public void TypesInLibGit2SharpMustBeExtensibleInATestingContext()

if (nonTestableTypes.Any())
{
Assert.True(false, Environment.NewLine + BuildNonTestableTypesMessage(nonTestableTypes));
Assert.Fail(Environment.NewLine + BuildNonTestableTypesMessage(nonTestableTypes));
}
}

Expand Down Expand Up @@ -287,7 +287,7 @@ public void GetEnumeratorMethodsInLibGit2SharpMustBeVirtualForTestability()
method.DeclaringType, Environment.NewLine);
}

Assert.True(false, Environment.NewLine + sb.ToString());
Assert.Fail(Environment.NewLine + sb.ToString());
}
}

Expand Down Expand Up @@ -316,7 +316,7 @@ public void NoPublicTypesUnderLibGit2SharpCoreNamespace()
type.FullName, coreNamespace, Environment.NewLine);
}

Assert.True(false, Environment.NewLine + sb.ToString());
Assert.Fail(Environment.NewLine + sb.ToString());
}
}

Expand Down
3 changes: 1 addition & 2 deletions LibGit2Sharp.Tests/PushFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ public class PushFixture : BaseFixture
{
private void OnPushStatusError(PushStatusError pushStatusErrors)
{
Assert.True(false, string.Format("Failed to update reference '{0}': {1}",
pushStatusErrors.Reference, pushStatusErrors.Message));
Assert.Fail(string.Format("Failed to update reference '{0}': {1}", pushStatusErrors.Reference, pushStatusErrors.Message));
}

private void AssertPush(Action<IRepository> push)
Expand Down
2 changes: 1 addition & 1 deletion LibGit2Sharp.Tests/TestHelpers/BaseFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ public virtual void Dispose()

if (Core.LeaksContainer.TypeNames.Any())
{
Assert.False(true, string.Format("Some handles of the following types haven't been properly released: {0}.{1}"
Assert.Fail(string.Format("Some handles of the following types haven't been properly released: {0}.{1}"
+ "In order to get some help fixing those leaks, uncomment the define LEAKS_TRACKING in Libgit2Object.cs{1}"
+ "and run the tests locally.", string.Join(", ", Core.LeaksContainer.TypeNames), Environment.NewLine));
}
Expand Down
0