diff options
Diffstat (limited to 'v_windows/v/old/vlib/v/tests/string_interpolation_multistmt_test.v')
-rw-r--r-- | v_windows/v/old/vlib/v/tests/string_interpolation_multistmt_test.v | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/v_windows/v/old/vlib/v/tests/string_interpolation_multistmt_test.v b/v_windows/v/old/vlib/v/tests/string_interpolation_multistmt_test.v new file mode 100644 index 0000000..7682659 --- /dev/null +++ b/v_windows/v/old/vlib/v/tests/string_interpolation_multistmt_test.v @@ -0,0 +1,16 @@ +// 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 := map{ + 'example': 'string' + 'other': 'data' + } + assert '${json.encode(object)}' == '{"example":"string","other":"data"}' +} |