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.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/internal/config/config_test.go b/internal/config/config_test.go
index cc0c941..53a3980 100644
--- a/internal/config/config_test.go
+++ b/internal/config/config_test.go
@@ -199,6 +199,31 @@ func TestSiglaStyleDefaultsAndDialect(t *testing.T) {
}
}
+func TestSaveRoundTrip(t *testing.T) {
+ dir := t.TempDir()
+ path := filepath.Join(dir, "config.toml")
+ t.Setenv("LECTIO_CONFIG", path)
+
+ cfg := Default()
+ cfg.UILanguage = "pl"
+ cfg.SiglaStyle = "english"
+ cfg.WebMono = true
+ cfg.WebVersions = []string{"wuj", "vul"}
+ cfg.Pager = "less -R"
+ cfg.Parts = map[string]map[string]bool{"new": {"psalm": false}}
+ if err := Save(cfg); err != nil {
+ t.Fatal(err)
+ }
+ got, err := Load()
+ if err != nil {
+ t.Fatalf("reload: %v", err)
+ }
+ if got.UILanguage != "pl" || got.SiglaStyle != "english" || !got.WebMono ||
+ len(got.WebVersions) != 2 || got.Pager != "less -R" || got.PartShown("new", "psalm") {
+ t.Errorf("round-trip mismatch: %+v", got)
+ }
+}
+
func TestPartShown(t *testing.T) {
var empty Config
if !empty.PartShown("new", "psalm") {