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

tests: another pointer struct test

This commit is contained in:
Alexander Medvednikov 2021-01-20 09:24:12 +01:00
parent 766ed20bf3
commit 57af8570fe

View File

@ -11,6 +11,23 @@ fn test_pointer_arithmetic() {
}
}
struct User {
mut:
name string
}
fn modify_ptr(mut user User) {
user.name = 'Bob'
}
fn test_mut_ptr() {
mut user := &User{'Peter'}
assert user.name == 'Peter'
modify_ptr(mut user)
assert user.name == 'Bob'
println(user)
}
/*
fn test_multi_level_pointer_dereferencing() {
n := 100