v2 / vlib / v / tests / pointers / pointer_arithmetic_test.v
6 lines · 6 sloc · 123 bytes · 6488041a749df9762348d019c4223908c476f2e2
Raw
1fn test_strings() {
2 s := 'hi'
3 mut p := unsafe { s.str + 1 }
4 n := unsafe { p - s.str }
5 assert typeof(n).name == 'int'
6}
7