mirror of https://github.com/mono/CppSharp.git
7 changed files with 72 additions and 11 deletions
@ -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); |
||||||
|
} |
||||||
|
} |
||||||
@ -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; |
||||||
|
} |
||||||
@ -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)); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
@ -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; |
||||||
|
}; |
||||||
Loading…
Reference in new issue