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

Fixed default parameters requiring conversion operators

This commit is contained in:
Brian Fiete 2020-03-11 07:57:20 -07:00
parent 5a63fec168
commit 7458a90b5b
7 changed files with 98 additions and 61 deletions

View file

@ -231,6 +231,13 @@ namespace Tests
{
return val.mA;
}
public static implicit operator Self(int val)
{
IntStruct sVal;
sVal.mA = val;
return sVal;
}
}
[Test]
@ -244,6 +251,12 @@ namespace Tests
const String cStrD = "D";
const char8* cStrPD = "D";
public static void TestDefaults(StringView sv = "ABC", IntStruct intStruct = 123)
{
Test.Assert(sv == "ABC");
Test.Assert(intStruct.mA == 123);
}
[Test]
public static void TestStringOp()
{
@ -254,6 +267,8 @@ namespace Tests
const char8* cStr3 = "A" + "B";
const char8* cStr4 = cStr1 + "C" + cStrPD;
Test.Assert(StringView(cStr4) == "ABCD");
TestDefaults();
}
}
}