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.go34
1 files changed, 34 insertions, 0 deletions
diff --git a/internal/config/config_test.go b/internal/config/config_test.go
index 616f0cd..0f7bea8 100644
--- a/internal/config/config_test.go
+++ b/internal/config/config_test.go
@@ -144,6 +144,40 @@ func TestUILanguageNormalizesUnknown(t *testing.T) {
}
}
+func TestPagerDefault(t *testing.T) {
+ def := Default()
+ if def.Pager != "" {
+ t.Errorf("Pager default should be empty, got %q", def.Pager)
+ }
+}
+
+func TestPagerLoadsFromSeed(t *testing.T) {
+ dir := t.TempDir()
+ t.Setenv("XDG_CONFIG_HOME", dir)
+ cfg, err := Load()
+ if err != nil {
+ t.Fatal(err)
+ }
+ if cfg.Pager != "" {
+ t.Errorf("Pager from seed wrong: got %q, want empty", cfg.Pager)
+ }
+}
+
+func TestPagerLoadsSetting(t *testing.T) {
+ dir := t.TempDir()
+ t.Setenv("XDG_CONFIG_HOME", dir)
+ os.MkdirAll(filepath.Join(dir, "lectio"), 0o755)
+ os.WriteFile(filepath.Join(dir, "lectio", "config.toml"),
+ []byte("pager = \"less -R\"\n"), 0o644)
+ cfg, err := Load()
+ if err != nil {
+ t.Fatal(err)
+ }
+ if cfg.Pager != "less -R" {
+ t.Errorf("Pager = %q, want %q", cfg.Pager, "less -R")
+ }
+}
+
func TestPartShown(t *testing.T) {
var empty Config
if !empty.PartShown("new", "psalm") {