Files
@ b4a9c41d70da
Branch filter:
Location: CSY/reowolf/src/protocol/tests/eval_calls.rs - annotation
b4a9c41d70da
729 B
application/rls-services+xml
Initial casting implementation
Explicit casts can be performed with the syntax 'cast<type>(input)'
and implicit casts can be performed with the syntax 'cast(input)'
where the output type is determined by inference.
To prevent casting shenanigans we only allow casting of primitive
types and of types to themselves (essentially creating a copy).
Explicit casts can be performed with the syntax 'cast<type>(input)'
and implicit casts can be performed with the syntax 'cast(input)'
where the output type is determined by inference.
To prevent casting shenanigans we only allow casting of primitive
types and of types to themselves (essentially creating a copy).
d36ad4f5458b d36ad4f5458b d36ad4f5458b d36ad4f5458b d36ad4f5458b d36ad4f5458b d36ad4f5458b d36ad4f5458b d36ad4f5458b d36ad4f5458b d36ad4f5458b d36ad4f5458b b69f417a9972 d36ad4f5458b d36ad4f5458b d36ad4f5458b d36ad4f5458b d36ad4f5458b d36ad4f5458b d36ad4f5458b d36ad4f5458b d36ad4f5458b d36ad4f5458b d36ad4f5458b d36ad4f5458b d36ad4f5458b d36ad4f5458b b69f417a9972 d36ad4f5458b d36ad4f5458b | use super::*;
#[test]
fn test_function_call() {
Tester::new_single_source_expect_ok("with literal arg", "
func add_two(u32 value) -> u32 {
return value + 2;
}
func foo() -> u32 {
return add_two(5);
}
").for_function("foo", |f| {
f.call_ok(Some(Value::UInt32(7)));
});
println!("\n\n\n\n\n\n\n");
Tester::new_single_source_expect_ok("with variable arg", "
func add_two(u32 value) -> u32 {
value += 1;
return value + 1;
}
func foo() -> bool {
auto initial = 5;
auto result = add_two(initial);
return initial == 5 && result == 7;
}").for_function("foo", |f| {
f.call_ok(Some(Value::Bool(true)));
});
}
|