1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-17 23:56:05 +02:00
Beef/IDEHelper/Tests/src/Properties.bf

77 lines
863 B
Beef
Raw Normal View History

2020-04-10 07:53:56 -07:00
#pragma warning disable 168
using System;
namespace Tests
{
class Properties
{
struct StructA
{
public int mA = 111;
public this()
{
}
public this(int a)
{
mA = a;
}
}
struct StructB
{
2020-05-08 16:35:05 -07:00
public StructA B { get; set mut; }
2020-04-10 07:53:56 -07:00
int mZ = 9;
public this()
{
B = .();
}
}
struct StructC
{
public StructA B { get; }
int mZ = 9;
public this()
{
B = .();
}
}
class ClassB
{
public StructA B { get; set; }
int mZ = 9;
public this()
{
}
}
[Test]
public static void TestBasics()
{
StructB sb = .();
StructA sa = sb.B;
Test.Assert(sa.mA == 111);
sb.B = .(222);
sa = sb.B;
Test.Assert(sa.mA == 222);
ClassB cb = scope .();
sa = cb.B;
Test.Assert(sa.mA == 0);
cb.B = .(333);
sa = cb.B;
Test.Assert(sa.mA == 333);
}
}
}