1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-23 10:08:00 +02:00

New tests

This commit is contained in:
Brian Fiete 2019-12-11 12:55:01 -08:00
parent b3cc0b5be4
commit fc063a65c1
3 changed files with 57 additions and 0 deletions

View file

@ -36,5 +36,42 @@ namespace Tests
int result = Add3(() => a++);
Test.Assert(result == 63);
}
[Test]
static void LambdaWithDtor()
{
int a = 10;
int b = 20;
//
{
delegate void() dlg = scope [&] () =>
{
a++;
}
~
{
b++;
};
dlg();
}
Test.Assert(a == 11);
Test.Assert(b == 21);
delegate void() dlg = new [&] () =>
{
a += 100;
}
~
{
b += 200;
};
dlg();
Test.Assert(a == 111);
Test.Assert(b == 21);
delete dlg;
Test.Assert(b == 221);
}
}
}