process/src/process.tests/_fixture/PlatformAttribute.cs

35 lines
1,019 B
C#
Raw Normal View History

2026-01-20 22:41:16 +01:00
// Copyright (c) The Geekeey Authors
// SPDX-License-Identifier: EUPL-1.2
namespace Geekeey.Process.Tests;
internal sealed class PlatformAttribute : SkipAttribute
{
// from the OperatingSystem definitions
public const string Browser = "BROWSER";
public const string Wasi = "WASI";
public const string Windows = "WINDOWS";
public const string Osx = "OSX";
public const string MacCatalyst = "MACCATALYST";
public const string Ios = "IOS";
public const string Tvos = "TVOS";
public const string Android = "ANDROID";
public const string Linux = "LINUX";
public const string Freebsd = "FREEBSD";
public const string Netbsd = "NETBSD";
public const string Illumos = "ILLUMOS";
public const string Solaris = "SOLARIS";
private readonly string[] _os;
public PlatformAttribute(params string[] os) : base("Test skipped on unsupported platform.")
{
_os = os;
}
public override Task<bool> ShouldSkip(TestRegisteredContext context)
{
return Task.FromResult(!_os.Any(OperatingSystem.IsOSPlatform));
}
}