blob: 5b5ed79eb8f9d58cb5e9a23843ac0f4cbaae7b5c (
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
27
28
29
30
31
32
33
34
35
36
37
38
|
//go:build windows
package configloader_test
import (
"os"
"path/filepath"
"testing"
"github.com/eugenetriguba/bolt/internal/configloader"
"gotest.tools/v3/assert"
)
func TestNewConfigWindowsSearchesToRootFilePath(t *testing.T) {
expectedCfg := configloader.Config{
MigrationsDir: "differentmigrationsdir",
}
configPath := filepath.Join(os.Getenv("SystemDrive"), "bolt.toml")
err := createConfigFile(t, &expectedCfg, configPath)
if err != nil {
t.Fatal(err)
}
homedir, err := os.UserHomeDir()
if err != nil {
t.Fatal(err)
}
err = os.Chdir(homedir)
if err != nil {
t.Fatal(err)
}
cfg, err := configloader.NewConfig()
if err != nil {
t.Fatal(err)
}
assert.DeepEqual(t, *cfg, expectedCfg)
}
|