Skip to content

ReplPlatformProfile

The platform whose signal-handling decisions a test wants to exercise, independent of the platform it is running on. Declaring one lets a Windows wiring decision be asserted from Linux and the other way round.

A declared platform changes decisions only, and never causes an operating-system registration to be installed on that platform’s behalf. One consequence is worth knowing: a profile with no signal bridge — Browser, Android, IOS, TvOS — installs no console cancel-key handler either, so while such a run is in flight a real Ctrl+C aimed at your test runner takes its normal course instead of being claimed by the run. Under the other profiles it is claimed, as it would be for any standalone run.

What a declared platform cannot buy: real delivery. No kernel will deliver a Windows console control event on Linux, and whether a registration would succeed on a given host is a fact about that host. Those need a spawned process on the matching platform.

Use the named profiles. The flags are readable so a test can assert on them, but not settable, so that combinations no device has — Android and Windows at once — cannot be built by mistake.

public sealed record ReplPlatformProfile : IEquatable<ReplPlatformProfile>
  • IEquatable<ReplPlatformProfile>

Android, where the signal bridge is unsupported and handling stays caller-owned.

public static ReplPlatformProfile Android { get; }

ReplPlatformProfile

WebAssembly in a browser, where the signal bridge is unsupported.

public static ReplPlatformProfile Browser { get; }

ReplPlatformProfile

The platform the test is actually running on, taken from OperatingSystem.

public static ReplPlatformProfile Current { get; }

ReplPlatformProfile

iOS or Mac Catalyst, where the signal bridge is unsupported.

public static ReplPlatformProfile IOS { get; }

ReplPlatformProfile

Whether the declared platform is Android.

public bool IsAndroid { get; }

bool

Whether the declared platform is WebAssembly in a browser.

public bool IsBrowser { get; }

bool

Whether the declared platform is iOS or Mac Catalyst.

public bool IsIOSOrMacCatalyst { get; }

bool

Whether the signal bridge is available at all on the declared platform. When it is not, automatic handling degrades to caller-owned and says so once through the run’s diagnostics.

public bool IsSignalBridgeSupported { get; }

bool

Whether the declared platform is tvOS.

public bool IsTvOS { get; }

bool

Whether the declared platform is Windows.

public bool IsWindows { get; }

bool

tvOS, where the signal bridge is unsupported.

public static ReplPlatformProfile TvOS { get; }

ReplPlatformProfile

Linux or macOS: Ctrl+Break is not a signal, and SIGTERM is registered. Both make the same decisions here, so they share one profile rather than pretending to differ.

public static ReplPlatformProfile Unix { get; }

ReplPlatformProfile

Windows: Ctrl+Break counts as a signal, and no SIGTERM registration is installed because the console keys are already owned by the cancel-key path.

public static ReplPlatformProfile Windows { get; }

ReplPlatformProfile