diff --git a/vlib/toml/tests/encode_and_decode_test.v b/vlib/toml/tests/encode_and_decode_test.v index 554b668738..bc29b1fb13 100644 --- a/vlib/toml/tests/encode_and_decode_test.v +++ b/vlib/toml/tests/encode_and_decode_test.v @@ -15,6 +15,11 @@ struct Pet { has_furr bool title JobTitle address Address + // *¹ Currently it is only possible to decode a single nested struct generically. + // As soon as we decode another nested struct (e.g. within this struct, like `contact` below) + // or only one nested struct within another struct, it results in wrong values or errors. + // Related issue: https://github.com/vlang/v/issues/18110 + // contact Contact } struct Address { @@ -22,6 +27,12 @@ struct Address { city string } +// *¹ +/* +struct Contact { + phone string +}*/ + struct Employee { mut: name string @@ -45,6 +56,8 @@ struct Arrs { } fn test_encode_and_decode() { + // *¹ + // p := Pet{'Mr. Scratchy McEvilPaws', ['Freddy', 'Fred', 'Charles'], 8, -1, 0.8, true, .manager, Address{'1428 Elm Street', 'Springwood'}, Contact{'123-456-7890'}} p := Pet{'Mr. Scratchy McEvilPaws', ['Freddy', 'Fred', 'Charles'], 8, -1, 0.8, true, .manager, Address{'1428 Elm Street', 'Springwood'}} s := 'name = "Mr. Scratchy McEvilPaws" nicknames = [ @@ -58,6 +71,7 @@ height = 0.8 has_furr = true title = 2 address = { street = "1428 Elm Street", city = "Springwood" }' + // contact = { phone = "123-456-7890" }' // *¹ assert toml.encode[Pet](p) == s assert toml.decode[Pet](s)! == p