From 51abb67b77ee9f0f33f641711df9b0c9b4d14263 Mon Sep 17 00:00:00 2001 From: Alexander Neonxp Kiryukhin Date: Tue, 17 Feb 2026 21:33:24 +0300 Subject: v0.0.1 --- loader_test.go | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 loader_test.go (limited to 'loader_test.go') diff --git a/loader_test.go b/loader_test.go new file mode 100644 index 0000000..acd689d --- /dev/null +++ b/loader_test.go @@ -0,0 +1,30 @@ +package conf_test + +import ( + "fmt" + + "go.neonxp.ru/conf" +) + +func ExampleLoad() { + config := ` + key = "value"; + group "test" { + key = 123; + } + ` + + cfg, err := conf.Load("example", []byte(config)) + if err != nil { + panic(err) + } + + fmt.Println("key =", cfg.Get("key")[0]) + group := cfg.Commands("group") + for _, gr := range group { + fmt.Println("key =", gr.Body.Get("key")[0]) + } + // Output: + // key = value + // key = 123 +} -- cgit v1.2.3