v2 / vlib / v / tests / keyword_as_params_field_test.v
24 lines · 21 sloc · 275 bytes · cebd999db839097c6c562de158816f619326a49e
Raw
1@[params]
2struct FooParams {
3 type FooType = .first
4}
5
6enum FooType {
7 first
8 second
9}
10
11fn foo(params FooParams) string {
12 match params.type {
13 .first {
14 return 'First'
15 }
16 .second {
17 return 'Second'
18 }
19 }
20}
21
22fn test_main() {
23 assert foo(type: .second) == 'Second'
24}
25