From bbcf12550f39ba7cd47b930e1c24a195db9ed922 Mon Sep 17 00:00:00 2001 From: Dimitar Dobrev Date: Sat, 18 Jul 2015 00:17:02 +0100 Subject: [PATCH] Prevented a crash in the tests on Mono because of a Mono bug. Signed-off-by: Dimitar Dobrev --- src/Core/Platform.cs | 2 +- src/Generator.Tests/GeneratorTest.cs | 2 +- tests/CSharpTemp/CSharpTemp.Tests.cs | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Core/Platform.cs b/src/Core/Platform.cs index 9ab18244..bbd83dee 100644 --- a/src/Core/Platform.cs +++ b/src/Core/Platform.cs @@ -50,7 +50,7 @@ namespace CppSharp public static bool IsMono { - get { return System.Type.GetType("Mono.Runtime") == null; } + get { return Type.GetType("Mono.Runtime") != null; } } } } diff --git a/src/Generator.Tests/GeneratorTest.cs b/src/Generator.Tests/GeneratorTest.cs index a57a1dde..62524b22 100644 --- a/src/Generator.Tests/GeneratorTest.cs +++ b/src/Generator.Tests/GeneratorTest.cs @@ -39,7 +39,7 @@ namespace CppSharp.Utils // Workaround for CLR which does not check for .dll if the // name already has a dot. - if (Platform.IsMono) + if (!Platform.IsMono) options.SharedLibraryName += ".dll"; var path = Path.GetFullPath(GetTestsDirectory(name)); diff --git a/tests/CSharpTemp/CSharpTemp.Tests.cs b/tests/CSharpTemp/CSharpTemp.Tests.cs index a83ae64c..505ecc23 100644 --- a/tests/CSharpTemp/CSharpTemp.Tests.cs +++ b/tests/CSharpTemp/CSharpTemp.Tests.cs @@ -60,6 +60,11 @@ public class CSharpTempTests : GeneratorTestFixture [Test] public void TestMultipleInheritance() { + // TODO: remove when the bug in question is fixed + if (Type.GetType("Mono.Runtime") != null) + { + Assert.Fail("Crashes with Mono because of a problem with marshalling arrays: https://gist.github.com/tritao/7e62c71ffe57d6bc326e"); + } using (var baz = new Baz()) { Assert.That(baz.Method, Is.EqualTo(1));