mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 23:04:08 +10:00
30 lines
405 B
Plaintext
30 lines
405 B
Plaintext
//test int -> float coercion
|
|
{
|
|
var f: float = 0;
|
|
|
|
assert typeof f == float, "coercion on decl failed";
|
|
|
|
f = 42;
|
|
|
|
assert typeof f == float, "coercion on assign failed";
|
|
}
|
|
|
|
|
|
//test function coercion
|
|
{
|
|
fn f(arg: float) {
|
|
assert typeof arg == float, "argument coercion failed";
|
|
}
|
|
|
|
f(42);
|
|
|
|
fn g(): float {
|
|
return 42;
|
|
}
|
|
|
|
assert typeof g() == float, "return coercion failed";
|
|
}
|
|
|
|
|
|
print "All good";
|