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

17 lines
414 B
V

// This file checks that string interpolations where expressions that generate
// multiple C statements work correctly
import json
fn test_array_map_interpolation() {
numbers := [1, 2, 3]
assert '${numbers.map(it * it)}' == '[1, 4, 9]'
}
fn test_json_encode_interpolation() {
object := {
'example': 'string'
'other': 'data'
}
assert '${json.encode(object)}' == '{"example":"string","other":"data"}'
}