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

26 lines
349 B
V
Raw Normal View History

module main
struct Aa {
sub AliasType
}
type AliasType = Bb
struct Bb {
a int
}
fn encode_struct[U](val U, mut out []string) []string {
$for field in U.fields {
encode_struct(val.$(field.name), mut out)
out << field.str()
}
return out
}
fn test_main() {
aa := Aa{}
mut out := []string{}
assert encode_struct(aa, mut out).len == 2
}