v2 / vlib / v / tests / comptime / comptime_call_or_block_test.v
21 lines · 18 sloc · 307 bytes · 6488041a749df9762348d019c4223908c476f2e2
Raw
1pub struct App {
2}
3
4pub fn (mut app App) app_index() ! {
5 return error('hhh')
6}
7
8pub fn (mut app App) no_error() {
9}
10
11fn test_main() {
12 mut app := App{}
13 mut ret2 := ''
14 $for method in App.methods {
15 $if method.is_pub {
16 app.$method() or { ret2 = err.msg() }
17 dump(ret2)
18 }
19 }
20 assert ret2 == 'hhh'
21}
22