diff --git a/scripts/Makefile b/scripts/Makefile index e1ab4f5fe3..ec910298ea 100644 --- a/scripts/Makefile +++ b/scripts/Makefile @@ -113,7 +113,7 @@ dotnetlibs/xunit.console.exe: $(MONAD_EXT)/xunit/xunit.console.netcore.exe cp -f $^ $@ TEST_FOLDER=../src/ps_test -TEST_SRCS=$(addprefix $(TEST_FOLDER)/, test_CorePsPlatform.cs) +TEST_SRCS=$(addprefix $(TEST_FOLDER)/, test_CorePsPlatform.cs test_ExtensionMethods.cs) dotnetlibs/ps_test.dll: $(TEST_SRCS) dotnetlibs/xunit.core.dll dotnetlibs/xunit.assert.dll dotnetlibs/System.Management.Automation.dll dotnetlibs/Microsoft.PowerShell.Commands.Management.dll dotnetlibs/$(ASSEMBLY_LOAD_CONTEXT_TARGET) $(CSC) -out:$@ -noconfig -nostdlib -target:library -r:dotnetlibs/System.Management.Automation.dll -r:dotnetlibs/$(ASSEMBLY_LOAD_CONTEXT_TARGET) -r:dotnetlibs/xunit.core.dll -r:dotnetlibs/xunit.assert.dll ${COREREF} $(TEST_SRCS) diff --git a/src/monad b/src/monad index d9e1a2c7b0..f8a9615707 160000 --- a/src/monad +++ b/src/monad @@ -1 +1 @@ -Subproject commit d9e1a2c7b0dbab00c185297952cfeaa31f3c5ea5 +Subproject commit f8a9615707051ba572b0cb7705054f9ae15d6b66 diff --git a/src/ps_test/ps_test.cs b/src/ps_test/ps_test.cs index a4a7185338..3a7f011f07 100644 --- a/src/ps_test/ps_test.cs +++ b/src/ps_test/ps_test.cs @@ -9,7 +9,11 @@ namespace PSTests // - Remove static keywords static void Main() { - PlatformTests.testIsLinux(); + PlatformTests.TestIsLinux(); + PlatformTests.TestHasCom(); + + PSTypeExtensionsTests.TestIsComObject(); + Console.WriteLine("Finished running tests"); } } diff --git a/src/ps_test/test_CorePsPlatform.cs b/src/ps_test/test_CorePsPlatform.cs index cc42fa245a..fb3f5a093f 100644 --- a/src/ps_test/test_CorePsPlatform.cs +++ b/src/ps_test/test_CorePsPlatform.cs @@ -1,13 +1,19 @@ using Xunit; using System; +using System.Management.Automation; namespace PSTests { public static class PlatformTests { - public static void testIsLinux() + public static void TestIsLinux() { - Assert.Equal(System.Management.Automation.Platform.IsLinux(), true); + Assert.True(Platform.IsLinux()); + } + + public static void TestHasCom() + { + Assert.False(Platform.HasCom()); } } } diff --git a/src/ps_test/test_ExtensionMethods.cs b/src/ps_test/test_ExtensionMethods.cs new file mode 100644 index 0000000000..b7b7d82ba8 --- /dev/null +++ b/src/ps_test/test_ExtensionMethods.cs @@ -0,0 +1,15 @@ +using Xunit; +using System; +using System.Management.Automation; + +namespace PSTests +{ + public static class PSTypeExtensionsTests + { + public static void TestIsComObject() + { + // It just needs an arbitrary type + Assert.False(PSTypeExtensions.IsComObject(42.GetType())); + } + } +}