v2 / vlib / v / tests / consts / const_cstr_test.v
14 lines · 13 sloc · 353 bytes · ccb3d5cfcd12f44375aed8832714398f7915251d
Raw
1pub const global_text = c'Text'
2pub const global_ref = &global_text
3pub const global_copy = global_text
4
5fn test_main() {
6 local_copy := global_text
7 println('${global_text}')
8 println('${global_ref}')
9 println('${local_copy}')
10 println('${global_copy}')
11 assert *global_copy == c'Text'
12 assert **global_ref == c'Text'
13 assert *global_text == c'Text'
14}
15