Skip to content

Commit

Permalink
Test coverage improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
martinsmith1968 committed Aug 24, 2024
1 parent 9f783dc commit 4a6e893
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/DNX.Extensions/IO/DirectoryInfoExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,12 @@ public static string GetRelativePath(this DirectoryInfo directoryInfo, Directory
: GetRelativePath(directoryInfo.FullName, owningDirectoryInfo.FullName)
.RemoveStartsWith($".{Path.DirectorySeparatorChar}");

#if NETSTANDARD2_1_OR_GREATER
if (relativePath == ".")
{
relativePath = string.Empty;
}
#endif

return relativePath;
}
Expand Down
3 changes: 3 additions & 0 deletions tests/DNX.Extensions.Benchmarks/DevelopmentConfig.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
using System.Diagnostics.CodeAnalysis;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Exporters;

namespace DNX.Extensions.Benchmarks;

[ExcludeFromCodeCoverage]
internal class DevelopmentConfig : ManualConfig
{
public DevelopmentConfig()
Expand Down
2 changes: 2 additions & 0 deletions tests/DNX.Extensions.Benchmarks/Program.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using BenchmarkDotNet.Running;

namespace DNX.Extensions.Benchmarks;

[ExcludeFromCodeCoverage]
public class Program
{
public static void Main()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using System.Diagnostics.CodeAnalysis;
using BenchmarkDotNet.Attributes;
using DNX.Extensions.Strings;

namespace DNX.Extensions.Benchmarks.Strings;

[ExcludeFromCodeCoverage]
[MemoryDiagnoser]
[MarkdownExporterAttribute.GitHub]
public class StringExtensionBenchmarks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ public static TheoryData<string, string, string> GetRelativePath_Data()
{
{ Path.Combine(Path.GetTempPath(), guid1), null, null },
{ null, Path.Combine(Path.GetTempPath(), guid1), null },
{ Path.Combine(Path.GetTempPath(), guid1), Path.Combine(Path.GetTempPath(), guid1), "" },
{ Path.Combine(Path.GetTempPath(), guid1), Path.Combine(Path.GetTempPath(), "abcdefg"), Path.Join("..", guid1) },
{ Path.Combine(Path.GetTempPath(), guid2), Path.Combine(Path.GetTempPath(), guid3), Path.Join("..", guid2) },
{ Path.Combine(Path.GetTempPath(), "abcdefg"), Path.Combine(Path.GetTempPath(), "abcdefg"), "" },
Expand Down

0 comments on commit 4a6e893

Please sign in to comment.