v0.2.0 toml-only, harden concurrency and env export, dep updates
Test / test (push) Canceled after 0s

This commit is contained in:
lixen committed 2026-09-28 16:55:58 -04:00
1 parent 3c35601179
commit e08467bf38
42 files changed
+2533 -4274

No files matched your search

+34
View File
@@ -0,0 +1,34 @@
package config
import "testing"
func TestOptionsAreOwned(t *testing.T) {
opts := DefaultLoadOptions()
opts.EnvWhitelist = map[string]bool{"value": true}
c := NewWithOptions(opts)
opts.Sources[0] = SourceFile
opts.EnvWhitelist["value"] = false
if c.GetPrecedence()[0] != SourceCLI || !c.options.EnvWhitelist["value"] {
t.Fatal("options retained caller-owned containers")
}
c.SetLoadOptions(LoadOptions{})
if err := c.Register("value", 0); err != nil {
t.Fatal(err)
}
if err := c.Set("value", 1); err != nil {
t.Fatal(err)
}
}
func TestExportEnvContainerValues(t *testing.T) {
c := New()
if err := c.Register("items", []string{"old"}); err != nil {
t.Fatal(err)
}
if err := c.Set("items", []string{"new"}); err != nil {
t.Fatal(err)
}
if got := c.ExportEnv("APP_")["APP_ITEMS"]; got == "" {
t.Fatal("changed slice was not exported")
}
}