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

vfmt: change all '$expr' to '${expr}' (#16428)

This commit is contained in:
yuyi
2022-11-15 21:53:13 +08:00
committed by GitHub
parent 56239b4a23
commit 017ace6ea7
859 changed files with 7156 additions and 7135 deletions

View File

@@ -25,7 +25,7 @@ fn main() {
println(x)
//
s := json.encode(x)
println('Employee x: $s')
println('Employee x: ${s}')
assert s == '{"name":"Peter","age":28,"salary":95000.5,"title":2}'
//
y := json.decode(Employee, s)!

View File

@@ -15,5 +15,5 @@ fn test_json_decode_with_optional_arg() {
fn print_info() !string {
dbconf := json.decode(DbConfig, os.read_file('dbconf.json')!)!
println(dbconf)
return '$dbconf'
return '${dbconf}'
}

View File

@@ -95,7 +95,7 @@ fn test_encode_decode_sumtype() {
enc := json.encode(game)
// eprintln('Encoded Game: $enc')
assert enc == '{"title":"Super Mega Game","player":{"name":"Monke","_type":"Human"},"other":[{"tag":"Pen","_type":"Item"},{"tag":"Cookie","_type":"Item"},1,"Stool",{"_type":"Time","value":$t.unix_time()}]}'
assert enc == '{"title":"Super Mega Game","player":{"name":"Monke","_type":"Human"},"other":[{"tag":"Pen","_type":"Item"},{"tag":"Cookie","_type":"Item"},1,"Stool",{"_type":"Time","value":${t.unix_time()}}]}'
dec := json.decode(SomeGame, enc)!
// eprintln('Decoded Game: $dec')
@@ -421,15 +421,15 @@ struct Info {
fn test_decode_null_object() {
info := json.decode(Info, '{"id": 22, "items": null, "maps": null}')!
assert info.id == 22
assert '$info.items' == '[]'
assert '$info.maps' == '{}'
assert '${info.items}' == '[]'
assert '${info.maps}' == '{}'
}
fn test_decode_missing_maps_field() {
info := json.decode(Info, '{"id": 22, "items": null}')!
assert info.id == 22
assert '$info.items' == '[]'
assert '$info.maps' == '{}'
assert '${info.items}' == '[]'
assert '${info.maps}' == '{}'
}
struct Foo2 {