1
0
mirror of https://github.com/twiglet/cs2j.git synced 2025-01-18 13:15:17 +01:00

add tests for lock() and accessing parents from parent namespaces

This commit is contained in:
Kevin Glynn 2012-02-07 13:43:09 +01:00
parent f6e7958041
commit 3528e2223e
4 changed files with 98 additions and 1 deletions

View File

@ -0,0 +1,22 @@
using System;
// Test translation for lock statements
namespace Tester.Parent.Child
{
public class ChildClass
{
private ParentClass myp = null;
public ChildClass(int val)
{
myp = new ParentClass(val);
int tmp = myp.GetHashCode();
}
}
}

View File

@ -0,0 +1,41 @@
using System;
// Test translation for lock statements
namespace Tester.Parent
{
public class ParentClass {
private int loc = 0;
public ParentClass(int val)
{
loc = val;
}
public int GetLoc()
{
return loc;
}
public override int GetHashCode(){
return 5;
}
private class ChildOne {
public int COloc = 0;
private class ChildChildOne
{
public ChildChildOne() { }
public ChildOne p = new ChildOne();
public ParentClass gp = new ParentClass(4);
}
}
}
}

View File

@ -0,0 +1,31 @@
using System;
// Test translation for lock statements
namespace Tester.Locker
{
class B {
public virtual void foo() {
lock(this)
Console.WriteLine("summat");
}
}
class D : B {
public new void foo() {
lock (new String[5])
{
Console.WriteLine("and");
Console.WriteLine("nuttin");
}
}
}
public class Test5 {
public static void T5Main(){
B b = new D();
b.foo();
Console.WriteLine("Done");
}
}
}

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@ -45,6 +45,9 @@
<Compile Include="Enums\PacketTester.cs" />
<Compile Include="Enums\Consts.cs" />
<Compile Include="Generics\Generics.cs" />
<Compile Include="Misc\locker.cs" />
<Compile Include="Misc\Namespaces\child.cs" />
<Compile Include="Misc\Namespaces\parent.cs" />
<Compile Include="Partial\PartialUserTwo.cs" />
<Compile Include="Partial\PartialInner.cs" />
<Compile Include="Partial\PartialOuterPartialInner.cs" />