fmt: fix alignment of struct init fields (#22025)

This commit is contained in:
yuyi 2024-08-11 14:11:24 +08:00 committed by GitHub
parent 99da5726db
commit c51d30bf53
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
671 changed files with 18817 additions and 18787 deletions

View file

@ -38,10 +38,10 @@ fn test_field_with_default_expr() {
data := '[{"net":1},{"net":2,"currencyId":"cjson"}]'
prices := json.decode([]Price, data)!
assert prices == [Price{
net: 1
net: 1
currency_id: 'cconst'
}, Price{
net: 2
net: 2
currency_id: 'cjson'
}]
}
@ -80,9 +80,9 @@ struct SomeGame {
fn test_encode_decode_sumtype() {
t := time.now()
game := SomeGame{
title: 'Super Mega Game'
title: 'Super Mega Game'
player: Human{'Monke'}
other: [
other: [
Entity(Item{'Pen'}),
Item{'Cookie'},
Animal.cat,
@ -155,7 +155,7 @@ fn test_parse_user() {
fn test_encode_decode_time() {
user := User2{
age: 25
age: 25
reg_date: time.new(year: 2020, month: 12, day: 22, hour: 7, minute: 23)
}
s := json.encode(user)
@ -173,12 +173,12 @@ fn (mut u User) foo() string {
fn test_encode_user() {
mut usr := User{
age: 10
nums: [1, 2, 3]
last_name: 'Johnson'
age: 10
nums: [1, 2, 3]
last_name: 'Johnson'
is_registered: true
typ: 0
pets: 'foo'
typ: 0
pets: 'foo'
}
expected := '{"age":10,"nums":[1,2,3],"lastName":"Johnson","IsRegistered":true,"type":0,"pet_animals":"foo"}'
out := json.encode(usr)
@ -265,30 +265,30 @@ fn test_nested_type() {
data := Data{
countries: [
Country{
name: 'UK'
name: 'UK'
cities: [City{'London'}, City{'Manchester'}]
},
Country{
name: 'KU'
name: 'KU'
cities: [City{'Donlon'}, City{'Termanches'}]
},
]
users: {
'Foo': User{
age: 10
nums: [1, 2, 3]
last_name: 'Johnson'
age: 10
nums: [1, 2, 3]
last_name: 'Johnson'
is_registered: true
typ: 0
pets: 'little foo'
typ: 0
pets: 'little foo'
}
'Boo': User{
age: 20
nums: [5, 3, 1]
last_name: 'Smith'
age: 20
nums: [5, 3, 1]
last_name: 'Smith'
is_registered: false
typ: 4
pets: 'little boo'
typ: 4
pets: 'little boo'
}
}
extra: {