MCPcopy
hub / github.com/nextdns/nextdns / Test_LoadConfig_stripsInlineComment

Function Test_LoadConfig_stripsInlineComment

host/service/config_test.go:82–95  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

80}
81
82func Test_LoadConfig_stripsInlineComment(t *testing.T) {
83 path := writeConfigFile(t, "debug false # enable for troubleshooting\n")
84 var val bool
85 c := map[string]ConfigEntry{
86 "debug": ConfigFlag{Value: &val, Default: false},
87 }
88 storer := ConfigFileStorer{File: path}
89 if err := storer.LoadConfig(c); err != nil {
90 t.Fatalf("LoadConfig: %v", err)
91 }
92 if val {
93 t.Errorf("expected false, got %v", val)
94 }
95}
96
97func Test_SaveConfig_preservesFullLineComments(t *testing.T) {
98 original := "# cache setting\ncache-size 100MB\n"

Callers

nothing calls this directly

Calls 3

LoadConfigMethod · 0.95
writeConfigFileFunction · 0.85
ErrorfMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…