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:
parent
200f25a38f
commit
d4ffed89c0
@ -72,3 +72,16 @@ fn test_typeof_on_sumtypes_of_structs() {
|
|||||||
assert typeof(c) == 'BoolExpr'
|
assert typeof(c) == 'BoolExpr'
|
||||||
assert typeof(d) == 'UnaryExpr'
|
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 ()'
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user