From 9f1bb6c97d9685fbb4afa7c1897cbc73acf44a05 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 16 Jan 2026 13:22:05 +0000 Subject: [PATCH] Add double pointer test to achieve 100% coverage for handleKeyValues Add TestIssue873_DoublePointerUnmarshaler to test pointer-to-pointer to Unmarshaler types. This covers the pointer dereferencing loop in handleKeyValues, bringing its coverage from 88% to 100%. Total coverage: 97.4% --- unmarshaler_test.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/unmarshaler_test.go b/unmarshaler_test.go index 0795625..99207fa 100644 --- a/unmarshaler_test.go +++ b/unmarshaler_test.go @@ -4826,3 +4826,26 @@ another.nested.key = "value2" assert.Equal(t, "value1", cfg.Section.Values["sub.key"]) assert.Equal(t, "value2", cfg.Section.Values["another.nested.key"]) } + +// Test pointer to pointer to Unmarshaler (covers pointer dereferencing loop) +func TestIssue873_DoublePointerUnmarshaler(t *testing.T) { + type Config struct { + Section **customTable873 `toml:"section"` + } + + doc := ` +[section] +key = "value" +` + + var cfg Config + err := toml.NewDecoder(bytes.NewReader([]byte(doc))). + EnableUnmarshalerInterface(). + Decode(&cfg) + + assert.NoError(t, err) + assert.True(t, cfg.Section != nil) + assert.True(t, *cfg.Section != nil) + assert.Equal(t, []string{"key"}, (*cfg.Section).Keys) + assert.Equal(t, "value", (*cfg.Section).Values["key"]) +}