github.com/elves/Elvish@v0.12.0/store/store_test.go (about) 1 package store 2 3 // This file also sets up the test fixture. 4 5 import ( 6 "fmt" 7 "io/ioutil" 8 "os" 9 ) 10 11 var tStore *Store 12 13 func init() { 14 f, err := ioutil.TempFile("", "elvish.test") 15 if err != nil { 16 panic(fmt.Sprintf("Failed to open temp file: %v", err)) 17 } 18 db, err := DefaultDB(f.Name()) 19 if err != nil { 20 panic(fmt.Sprintf("Failed to create Store instance: %v", err)) 21 } 22 os.Remove(f.Name()) 23 24 tStore, err = NewStoreDB(db) 25 if err != nil { 26 panic(fmt.Sprintf("Failed to create Store instance: %v", err)) 27 } 28 }