Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
felipensp committed Nov 6, 2024
1 parent b564cbf commit 2d26063
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions vlib/v/gen/c/testdata/autofree_json_encode.c.must_have
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
string _arg_expr_json_encode_pretty_114 = json__json_print_pretty(_t1);
string_free(&_arg_expr_json_encode_pretty_114);
string _arg_expr_json_encode_143 = json__json_print(_t2);
string d = (_arg_expr_json_encode_143);
string_free(&d); // autofreed var main false
16 changes: 16 additions & 0 deletions vlib/v/gen/c/testdata/autofree_json_encode.vv
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// vtest vflags: -autofree
import json

struct Foo {
foo int
}

fn main() {
mut a := {
'foo': 123
}
println(json.encode_pretty(a))
d := json.encode(a)
dump(d)
println(json.decode(Foo, d)!)
}

0 comments on commit 2d26063

Please sign in to comment.