github.com/metux/go-metabuild@v0.0.0-20240118143255-d9ed5ab697f9/spec/testutil.go (about) 1 package spec 2 3 // this file is just for tests in other packages 4 5 import ( 6 "os" 7 "testing" 8 9 "github.com/metux/go-metabuild/spec/global" 10 ) 11 12 var ( 13 GlobalTestSpec *global.Global 14 ) 15 16 func LoadTestSpec(t *testing.T) { 17 os.Chdir("../examples") 18 19 if GlobalTestSpec != nil { 20 return 21 } 22 if gs, err := global.LoadGlobal("pkg/zlib/metabuild.yaml", "conf/settings.xml"); err == nil { 23 GlobalTestSpec = &gs 24 } else { 25 t.Fatalf("yaml load failed: %s", err) 26 } 27 }