1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-27 20:18:01 +02:00

Argument cascades

This commit is contained in:
Brian Fiete 2021-01-02 08:11:07 -08:00
parent 0692fb44a4
commit 2dbcca8ca4
8 changed files with 98 additions and 8 deletions

View file

@ -0,0 +1,33 @@
using System;
namespace Tests
{
class Cascades
{
public static void MethodA(int a, float b)
{
}
public static void MethodB(int a, out float b)
{
b = 100;
}
[Test]
public static void TestBasics()
{
int a = MethodA(.. 12, 2.3f);
Test.Assert(a == 12);
var (b, c) = MethodA(.. 12, .. 2.3f);
Test.Assert(b == 12);
Test.Assert(c == 2.3f);
var d = MethodA(.. 12, .. 2.3f);
Test.Assert(d == (12, 2.3f));
var f = ref MethodB(12, .. var e);
e += 23;
Test.Assert(e == (int)123);
Test.Assert(f == (int)123);
}
}
}