Gitly
English
Русский
Español
日本語
中文
Português
Pricing
Log in
Register
vxx
/
vlib
/
v
/
tests
/
aliases
/
alias_struct_ref_mut_capture_test.v
20
lines
·
17
sloc
·
247 bytes
·
d1b4f6507d7d93e897ac6fa20211cf87c9b9f67a
Raw
1
struct
App {
2
mut
:
3
score int
4
}
5
6
type
AppRef = &App
7
8
fn
make_handler(
mut
app AppRef)
fn
() {
9
return
fn
[
mut
app] () {
10
app.score++
11
}
12
}
13
14
fn
test_main() {
15
mut
a := App{}
16
h := make_handler(
mut
&a)
17
assert a.score == 0
18
h()
19
assert a.score == 1
20
}
21