vxx2 / vlib / v / checker / tests / string_interpolation_wrong_fmt.vv
24 lines · 22 sloc · 352 bytes · f2d9fa38155f6cf3893175cd19301f2dbb7b132b
Raw
1fn interpolate_str() string {
2 a := 'hallo'
3 x := '>${a:8.3s}<'
4 y := '${a:G}'
5 z := '${a:d}'
6 return x + y + z
7}
8
9fn interpolate_f64() string {
10 b := 1367.57
11 x := '>${b:20s}<'
12 y := '${b:d}'
13 return x + y
14}
15
16fn interpolate_int() string {
17 u := u32(15)
18 s := -12
19 x := '${u:13d}'
20 y := '${s:04u}'
21 z := '${s:f}'
22 q := '${u:v}'
23 return x + y + z + q
24}
25