diff options
| -rw-r--r-- | internal/cli/main_test.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/internal/cli/main_test.go b/internal/cli/main_test.go new file mode 100644 index 0000000..62989e5 --- /dev/null +++ b/internal/cli/main_test.go @@ -0,0 +1,26 @@ +package cli + +import ( + "os" + "path/filepath" + "testing" +) + +// TestMain isolates the cli test suite from the developer's real +// ~/.config/lectio. Several reference/random tests assume English book +// abbreviations (e.g. "Jn 3:16"); a user config with ui_language = pl makes +// sigla_style = auto resolve to the Polish dialect, where "Jn" is not a valid +// abbreviation, so those tests fail on such a developer's machine even though +// they pass on a clean CI. Pointing LECTIO_CONFIG at a throwaway, +// non-existent path forces the built-in defaults for every cli test and keeps +// the suite from ever reading -- or writing -- the real user config. +func TestMain(m *testing.M) { + dir, err := os.MkdirTemp("", "lectio-cli-test") + if err != nil { + panic(err) + } + os.Setenv("LECTIO_CONFIG", filepath.Join(dir, "config.ini")) + code := m.Run() + os.RemoveAll(dir) + os.Exit(code) +} |
