Skip to content

Commit

Permalink
Added Testcase for #766
Browse files Browse the repository at this point in the history
  • Loading branch information
liiir1985 committed Dec 29, 2023
1 parent 51d4c0c commit f5b1d95
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 6 deletions.
6 changes: 0 additions & 6 deletions TestCases/CLRBindingTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,42 +143,36 @@ public static void CLRBindingTestEnd()
ILRuntimeTest.TestBase.TestSession.LastSession.Appdomain.AllowUnboundCLRMethod = true;
}

[ILRuntimeTest.ILRuntimeTest(ExpectException = typeof(ILRuntimeException))]
public static void CLRBindingTestMissing01()
{
ILRuntimeTest.TestFramework.TestCLRBinding binding = new ILRuntimeTest.TestFramework.TestCLRBinding();
binding.MissingMethod();
}

[ILRuntimeTest.ILRuntimeTest(ExpectException = typeof(ILRuntimeException))]
public static void CLRBindingTestMissing02()
{
ILRuntimeTest.TestFramework.TestCLRBinding binding = new ILRuntimeTest.TestFramework.TestCLRBinding();
binding.MissingMethodGeneric<TestCls2>(null);
}

[ILRuntimeTest.ILRuntimeTest(ExpectException = typeof(ILRuntimeException))]
public static void CLRBindingTestMissing03()
{
ILRuntimeTest.TestFramework.TestCLRBinding binding = new ILRuntimeTest.TestFramework.TestCLRBinding();
binding.missingField = 123;
}

[ILRuntimeTest.ILRuntimeTest(ExpectException = typeof(ILRuntimeException))]
public static void CLRBindingTestMissing04()
{
ILRuntimeTest.TestFramework.TestCLRBinding binding = new ILRuntimeTest.TestFramework.TestCLRBinding();
binding.Emit<MissingType>(null);
}

[ILRuntimeTest.ILRuntimeTest(ExpectException = typeof(ILRuntimeException))]
public static void CLRBindingTestMissing05()
{
ILRuntimeTest.TestFramework.TestCLRBinding binding = new ILRuntimeTest.TestFramework.TestCLRBinding();
binding.MissingMethodGeneric<MissingType>(null);
}

[ILRuntimeTest.ILRuntimeTest(ExpectException = typeof(ILRuntimeException))]
public static void CLRBindingTestMissing08()
{
MissingType mt = new MissingType();
Expand Down
50 changes: 50 additions & 0 deletions TestCases/RegisterVMTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
using ILRuntimeTest;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using static System.Runtime.CompilerServices.RuntimeHelpers;

namespace TestCases
{
public class RegisterVMTest
{
public static void RegisterVMTest01()
{
InlineTest test = new InlineTest();
test.DoTest(true);
}

class InlineTest
{
int a;

int A
{
get
{
if (a > 10)
return 10;

if (a < 2)
return 2;

return a;
}
}

public void DoTest(bool arg)
{
if (arg)
{
a = 8;
var tmp = A;
if (tmp != 8)
throw new Exception();
Console.WriteLine(tmp);
}
}
}
}
}

0 comments on commit f5b1d95

Please sign in to comment.