aboutsummaryrefslogtreecommitdiff
path: root/internal/config/config_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/config/config_test.go')
-rw-r--r--internal/config/config_test.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/internal/config/config_test.go b/internal/config/config_test.go
index 38c7604..e3af475 100644
--- a/internal/config/config_test.go
+++ b/internal/config/config_test.go
@@ -239,6 +239,27 @@ func TestSelectionFromINI(t *testing.T) {
}
}
+func TestUseLayers(t *testing.T) {
+ dir := t.TempDir()
+ t.Setenv("LECTIO_CONFIG", filepath.Join(dir, "config.ini"))
+ os.WriteFile(filepath.Join(dir, "config.ini"), []byte("use = poland, krakow\n"), 0o644)
+ cfg, err := Load()
+ if err != nil {
+ t.Fatal(err)
+ }
+ if len(cfg.Use) != 2 || cfg.Use[0] != "poland" || cfg.Use[1] != "krakow" {
+ t.Fatalf("Use = %v", cfg.Use)
+ }
+ // round-trips through Save
+ if err := Save(cfg); err != nil {
+ t.Fatal(err)
+ }
+ got, _ := Load()
+ if len(got.Use) != 2 || got.Use[1] != "krakow" {
+ t.Errorf("Use after round-trip = %v", got.Use)
+ }
+}
+
func TestMigrateTOMLToINI(t *testing.T) {
dir := t.TempDir()
t.Setenv("XDG_CONFIG_HOME", dir)