1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

add typeof test for fn (#3832)

This commit is contained in:
lydiandy 2020-02-25 18:14:59 +08:00 committed by GitHub
parent 200f25a38f
commit d4ffed89c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -72,3 +72,16 @@ fn test_typeof_on_sumtypes_of_structs() {
assert typeof(c) == 'BoolExpr'
assert typeof(d) == 'UnaryExpr'
}
type MyFn fn(int) int
type MyFn2 fn()
fn myfn(i int) int {
return i
}
fn myfn2() {}
fn test_typeof_on_fn() {
assert typeof(myfn) == 'fn (int) int'
assert typeof(myfn2) == 'fn ()'
}