diff --git a/tests/Basic/Basic.Tests.cs b/tests/Basic/Basic.Tests.cs index 846d4d99..395b8bb1 100644 --- a/tests/Basic/Basic.Tests.cs +++ b/tests/Basic/Basic.Tests.cs @@ -117,13 +117,6 @@ public class BasicTests Assert.AreEqual(abstractFoo.pureFunction2(), 15); } - [Test, Ignore] - public void TestPropertyAccessModifier() - { - Assert.That(typeof(Foo2).GetProperty("P", - BindingFlags.Instance | BindingFlags.NonPublic), Is.Not.Null); - } - [Test] public void TestANSI() { diff --git a/tests/Basic/Basic.h b/tests/Basic/Basic.h index 0dd190d2..b020aece 100644 --- a/tests/Basic/Basic.h +++ b/tests/Basic/Basic.h @@ -29,10 +29,6 @@ public: Foo2 operator<<(signed int i); Foo2 operator<<(signed long l); - - // TODO: uncomment when the C++/CLI back-end supports protected members -//protected: -// int P; }; struct DLL_API Bar diff --git a/tests/CSharpTemp/CSharpTemp.Tests.cs b/tests/CSharpTemp/CSharpTemp.Tests.cs new file mode 100644 index 00000000..afce2c5b --- /dev/null +++ b/tests/CSharpTemp/CSharpTemp.Tests.cs @@ -0,0 +1,21 @@ +using System.Reflection; +using NUnit.Framework; +using Foo = CSharpTemp.Foo; + +[TestFixture] +public class CSharpTempTests +{ + [Test] + public void TestIndexer() + { + var foo = new Foo(); + Assert.That(foo[0], Is.EqualTo(5)); + } + + [Test] + public void TestPropertyAccessModifier() + { + Assert.That(typeof(Foo).GetProperty("P", + BindingFlags.Instance | BindingFlags.NonPublic), Is.Not.Null); + } +} \ No newline at end of file diff --git a/tests/CSharpTemp/CSharpTemp.cpp b/tests/CSharpTemp/CSharpTemp.cpp new file mode 100644 index 00000000..a90f00e1 --- /dev/null +++ b/tests/CSharpTemp/CSharpTemp.cpp @@ -0,0 +1,12 @@ +#include "CSharpTemp.h" + +// TODO: move this, it has nothing to do with Unicode, it's here only not to break the CLI branch +int Foo::operator[](int i) const +{ + return 5; +} + +int Foo::operator[](int i) +{ + return 5; +} \ No newline at end of file diff --git a/tests/CSharpTemp/CSharpTemp.cs b/tests/CSharpTemp/CSharpTemp.cs new file mode 100644 index 00000000..30bc0ef6 --- /dev/null +++ b/tests/CSharpTemp/CSharpTemp.cs @@ -0,0 +1,22 @@ +using CppSharp.Generators; +using CppSharp.Utils; + +namespace CppSharp.Tests +{ + public class CSharpTempTests : LibraryTest + { + public CSharpTempTests(LanguageGeneratorKind kind) + : base("CSharpTemp", kind) + { + } + + static class Program + { + public static void Main(string[] args) + { + ConsoleDriver.Run(new CSharpTempTests(LanguageGeneratorKind.CSharp)); + } + } + } +} + diff --git a/tests/CSharpTemp/CSharpTemp.h b/tests/CSharpTemp/CSharpTemp.h new file mode 100644 index 00000000..62f00aa1 --- /dev/null +++ b/tests/CSharpTemp/CSharpTemp.h @@ -0,0 +1,15 @@ +#if defined(_MSC_VER) +#define DLL_API __declspec(dllexport) +#else +#define DLL_API +#endif + +class DLL_API Foo +{ +public: + int operator[](int i) const; + int operator[](int i); + +protected: + int P; +}; diff --git a/tests/CSharpTemp/premake4.lua b/tests/CSharpTemp/premake4.lua new file mode 100644 index 00000000..51423dbe --- /dev/null +++ b/tests/CSharpTemp/premake4.lua @@ -0,0 +1,2 @@ +group "Tests/CSharpTemp" + SetupTestCSharp("CSharpTemp") \ No newline at end of file