aboutsummaryrefslogtreecommitdiff
path: root/loader_test.go
diff options
context:
space:
mode:
author2026-02-17 21:33:24 +0300
committer2026-02-21 16:23:10 +0300
commitba06314d59e55945b103ead2c7a9e01f58c6a93c (patch)
tree34ab8ac19307da60bd5caf76d844a6dc2e730361 /loader_test.go
parentinit (diff)
downloadconf-ba06314d59e55945b103ead2c7a9e01f58c6a93c.tar.gz
conf-ba06314d59e55945b103ead2c7a9e01f58c6a93c.tar.bz2
conf-ba06314d59e55945b103ead2c7a9e01f58c6a93c.tar.xz
conf-ba06314d59e55945b103ead2c7a9e01f58c6a93c.zip
v0.0.1v0.0.1
Diffstat (limited to 'loader_test.go')
-rw-r--r--loader_test.go30
1 files changed, 30 insertions, 0 deletions
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
+}