mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 20:42:21 +02:00
Fixed params expression with ref values
This commit is contained in:
parent
4fe6bcaa86
commit
e82daf74d4
9 changed files with 29 additions and 45 deletions
|
@ -140,6 +140,29 @@ namespace Tests
|
|||
ca.TestLambda();
|
||||
}
|
||||
|
||||
public static void Modify(ref int a, ref Splattable b)
|
||||
{
|
||||
a += 1000;
|
||||
b.mA += 2000;
|
||||
b.mB += 3000;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public static void TestRefs()
|
||||
{
|
||||
delegate void(ref int a, ref Splattable b) dlg = scope => Modify;
|
||||
|
||||
int a = 123;
|
||||
Splattable splat = .();
|
||||
splat.mA = 234;
|
||||
splat.mB = 345;
|
||||
|
||||
dlg(ref a, ref splat);
|
||||
Test.Assert(a == 1123);
|
||||
Test.Assert(splat.mA == 2234);
|
||||
Test.Assert(splat.mB == 3345);
|
||||
}
|
||||
|
||||
public static void TestCasting()
|
||||
{
|
||||
delegate int(int, int) dlg0 = null;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue