Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Adds OSPlatform.FreeBSD. #2533

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ public struct OSPlatform : IEquatable<OSPlatform>
private static readonly OSPlatform s_osx = new OSPlatform(OSXName);
private static readonly OSPlatform s_windows = new OSPlatform(WindowsName);

public static OSPlatform FreeBSD
{
get
{
return s_freebsd;
}
}

public static OSPlatform Linux
{
get
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
// Copyright (c) Microsoft. All rights reserved.
// Copyright (c) Microsoft. All rights reserved.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added 💣, as this was the only .cs file in this directory missing BOM.

// Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace System.Runtime.InteropServices
{
public static class RuntimeInformation
{
private static OSPlatform s_freeBSD = OSPlatform.Create("FREEBSD");

public static bool IsOSPlatform(OSPlatform osPlatform)
{
return s_freeBSD == osPlatform;
return OSPlatform.FreeBSD == osPlatform;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,21 @@ namespace System.Runtime.InteropServices.RuntimeInformationTests
{
public class CheckPlatformTests
{
[Fact, PlatformSpecific(PlatformID.FreeBSD)]
public void CheckFreeBSD()
{
Assert.True(RuntimeInformation.IsOSPlatform(OSPlatform.FreeBSD));
Assert.True(RuntimeInformation.IsOSPlatform(OSPlatform.Create("FREEBSD")));

Assert.False(RuntimeInformation.IsOSPlatform(OSPlatform.Linux));
Assert.False(RuntimeInformation.IsOSPlatform(OSPlatform.Create("linux")));
Assert.False(RuntimeInformation.IsOSPlatform(OSPlatform.Create("UNIX")));
Assert.False(RuntimeInformation.IsOSPlatform(OSPlatform.Create("DARWIN")));
Assert.False(RuntimeInformation.IsOSPlatform(OSPlatform.Create("ubuntu")));
Assert.False(RuntimeInformation.IsOSPlatform(OSPlatform.Windows));
Assert.False(RuntimeInformation.IsOSPlatform(OSPlatform.OSX));
}

[Fact, PlatformSpecific(PlatformID.Linux)]
public void CheckLinux()
{
Expand Down