Skip to content
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
33 changes: 20 additions & 13 deletions Source/Testably.Abstractions.Testing/Helpers/Execute.LinuxPath.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
using System.IO;
#if FEATURE_SPAN
using System;
#endif

namespace Testably.Abstractions.Testing.Helpers;
namespace Testably.Abstractions.Testing.Helpers;

internal partial class Execute
{
private class LinuxPath(MockFileSystem fileSystem) : NativePath(fileSystem)
private class LinuxPath(MockFileSystem fileSystem) : SimulatedPath(fileSystem)
{
#if FEATURE_SPAN
/// <inheritdoc cref="Path.IsPathRooted(ReadOnlySpan{char})" />
public override bool IsPathRooted(ReadOnlySpan<char> path)
=> IsPathRooted(path.ToString());
#endif
/// <inheritdoc cref="IPath.AltDirectorySeparatorChar" />
public override char AltDirectorySeparatorChar => '/';

/// <inheritdoc cref="IPath.DirectorySeparatorChar" />
public override char DirectorySeparatorChar => '/';

/// <inheritdoc cref="IPath.PathSeparator" />
public override char PathSeparator => ':';

/// <inheritdoc cref="IPath.VolumeSeparatorChar" />
public override char VolumeSeparatorChar => '/';

/// <inheritdoc cref="IPath.GetInvalidFileNameChars()" />
public override char[] GetInvalidFileNameChars() => ['\0', '/'];

/// <inheritdoc cref="IPath.GetInvalidPathChars()" />
public override char[] GetInvalidPathChars() => ['\0'];

/// <inheritdoc cref="Path.IsPathRooted(string)" />
/// <inheritdoc cref="IPath.IsPathRooted(string)" />
public override bool IsPathRooted(string? path)
=> path?.Length > 0 && path[0] == '/';
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
#if FEATURE_SPAN
#endif
#if FEATURE_FILESYSTEM_NET7
using Testably.Abstractions.Testing.Storage;
#endif

namespace Testably.Abstractions.Testing.Helpers;
namespace Testably.Abstractions.Testing.Helpers;

internal partial class Execute
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#if FEATURE_SPAN
using System.Diagnostics.CodeAnalysis;
using System.IO;
#if FEATURE_SPAN
using System;
#endif
using System.Diagnostics.CodeAnalysis;
using System.IO;
#if FEATURE_FILESYSTEM_NET7
using Testably.Abstractions.Testing.Storage;
#endif
Expand All @@ -11,7 +11,7 @@ namespace Testably.Abstractions.Testing.Helpers;

internal partial class Execute
{
private class NativePath(MockFileSystem fileSystem) : IPath
private sealed class NativePath(MockFileSystem fileSystem) : IPath
{
#region IPath Members

Expand Down Expand Up @@ -228,12 +228,12 @@ public bool IsPathFullyQualified(string path)

#if FEATURE_SPAN
/// <inheritdoc cref="Path.IsPathRooted(ReadOnlySpan{char})" />
public virtual bool IsPathRooted(ReadOnlySpan<char> path)
public bool IsPathRooted(ReadOnlySpan<char> path)
=> System.IO.Path.IsPathRooted(path);
#endif

/// <inheritdoc cref="Path.IsPathRooted(string)" />
public virtual bool IsPathRooted(string? path)
public bool IsPathRooted(string? path)
=> System.IO.Path.IsPathRooted(path);

#if FEATURE_PATH_JOIN
Expand Down
Loading