Skip to content

Commit be8023b

Browse files
committed
tests: simplify vlib/v/tests/skip_unused/generic_call_from_json.vv
1 parent 84152cc commit be8023b

3 files changed

Lines changed: 8 additions & 19 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ok
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ok
Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,23 @@
1-
import veb
21
import x.json2
32

4-
pub struct Context {
5-
veb.Context
6-
}
7-
8-
pub struct App {
9-
veb.Middleware[Context]
10-
}
11-
12-
@['/'; POST]
13-
fn (app &App) index(mut ctx Context) veb.Result {
14-
j := json2.decode[json2.Any](ctx.req.data) or { return ctx.request_error('error') }
15-
3+
fn f() ! {
4+
j := json2.decode[json2.Any]('')!
165
m := j.as_map()
176
myarr := m['myarr'] or { panic(error) }
187
m2 := myarr.arr()
19-
208
for mc in m2 {
219
parts := mc.arr()
22-
2310
// Compiler error occurs here -->
2411
first := parts[0].str()
2512
second := parts[1].str()
2613
third := parts[2].str()
27-
2814
println('1. ${first}, 2. ${second}, 3. ${third}')
2915
}
30-
31-
return ctx.ok('ok')
3216
}
3317

3418
fn main() {
35-
_ := &App{}
19+
if false {
20+
f()!
21+
}
22+
println('ok')
3623
}

0 commit comments

Comments
 (0)