test: pin the embedded map and map merge rules
Test / test (push) Successful in 1m34s

Assisted-by: GLM 5.3 Flash
This commit is contained in:
2026-09-22 00:23:41 +02:00
parent 10391a090f
commit 13ac6dd521
2 changed files with 59 additions and 2 deletions
+5 -2
View File
@@ -202,7 +202,8 @@ table with `Number`, which keeps the literal; see
- `*struct`, matched per the field rules below
- `*map[string]any` or `*map[string]T`, keys become map keys and values decode
into `T` recursively
into `T` recursively; a map that already holds entries is merged into, the
document's values replacing same-named keys and the rest left standing
- `*OrderedMap`, the keys fill in the order the document wrote them; see
[Ordered tables](#ordered-tables)
- `*any`, receives the whole parsed tree unchanged
@@ -220,7 +221,9 @@ For a struct destination, a TOML key matches a field as follows:
into the embedded struct and matches its own fields against the same keys,
mirroring how the encoder flattens it. A nil embedded pointer struct is
allocated on demand. An untagged embedded map receives the keys no field
claims.
claims; when a struct embeds several untagged maps, the first one
declared takes all of them and the rest stay untouched, so the rule stays
predictable.
4. The key itself is lower-cased before lookup, so the match is
case-insensitive on both sides: `DATABASEURL` matches a field named
`DatabaseUrl`.