blob: 62989e5fbbfe0b69ea8d7b0bc24ed7021fe01268 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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)
}
|