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

println: optimize and remove memory leaks

This commit is contained in:
Alexander Medvednikov
2019-07-03 23:53:48 +02:00
parent 5d4d3b838b
commit 1e32a4cec4
3 changed files with 37 additions and 18 deletions

View File

@ -8,6 +8,7 @@ struct B{
mut:
a A
}
struct C {
mut:
b B
@ -15,6 +16,11 @@ mut:
as []A
num int
}
struct User {
name string
age int
}
fn test_struct_levels() {
mut c := C{}
@ -42,3 +48,9 @@ fn test_struct_levels() {
c.as[0].val = 10
assert c.as[0].val == 10
}
fn test_struct_str() {
u := User{'Bob', 30}
println(u) // make sure the struct is printable
// assert u.str() == '{name:"Bob", age:30}' // TODO
}