(t *testing.T)
| 2462 | } |
| 2463 | |
| 2464 | func TestUnmarshal_DotSeparatorBackwardCompatibility(t *testing.T) { |
| 2465 | flags := pflag.NewFlagSet("test", pflag.ContinueOnError) |
| 2466 | flags.String("foo.bar", "cobra_flag", "") |
| 2467 | |
| 2468 | v := New() |
| 2469 | assert.NoError(t, v.BindPFlags(flags)) |
| 2470 | |
| 2471 | config := &struct { |
| 2472 | Foo struct { |
| 2473 | Bar string |
| 2474 | } |
| 2475 | }{} |
| 2476 | |
| 2477 | assert.NoError(t, v.Unmarshal(config)) |
| 2478 | assert.Equal(t, "cobra_flag", config.Foo.Bar) |
| 2479 | } |
| 2480 | |
| 2481 | // var yamlExampleWithDot = []byte(`Hacker: true |
| 2482 | // name: steve |
nothing calls this directly
no test coverage detected