Decoder: disallow modification of existing table (#704)

Fixes #703
This commit is contained in:
Thomas Pelletier
2021-12-15 11:05:27 -05:00
committed by GitHub
parent facb2b13e8
commit 696dd25c17
3 changed files with 130 additions and 97 deletions
+7 -1
View File
@@ -2129,7 +2129,7 @@ xz_hash = "1a48f723fea1f17d786ce6eadd9d00914d38062d28fd9c455ed3c3801905b388"
expected := doc{
Pkg: map[string]pkg{
"cargo": pkg{
"cargo": {
Target: map[string]target{
"aarch64-apple-darwin": {
XZ_URL: "https://static.rust-lang.org/dist/2021-07-29/cargo-1.54.0-aarch64-apple-darwin.tar.xz",
@@ -2298,6 +2298,12 @@ z=0
}
}
func TestIssue703(t *testing.T) {
var v interface{}
err := toml.Unmarshal([]byte("[a]\nx.y=0\n[a.x]"), &v)
require.Error(t, err)
}
func TestUnmarshalDecodeErrors(t *testing.T) {
examples := []struct {
desc string