summaryrefslogtreecommitdiff
path: root/common_test.go
blob: 38fe5f184c950be16f8f971f9e384cc2b551edad (plain)
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 complete

import (
	"os"
	"sync"
	"testing"
)

var once = sync.Once{}

func initTests() {
	once.Do(func() {
		// Set debug environment variable so logs will be printed
		if testing.Verbose() {
			os.Setenv(envDebug, "1")
			// refresh the logger with environment variable set
			Log = getLogger()
		}

		// Change to tests directory for testing completion of files and directories
		err := os.Chdir("./tests")
		if err != nil {
			panic(err)
		}
	})
}