mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-27 20:18:01 +02:00
Argument cascades
This commit is contained in:
parent
0692fb44a4
commit
2dbcca8ca4
8 changed files with 98 additions and 8 deletions
33
IDEHelper/Tests/src/Cascades.bf
Normal file
33
IDEHelper/Tests/src/Cascades.bf
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue