github.com/ncruces/go-sqlite3@v0.15.1-0.20240520133447-53eef1510ff0/tests/vfs_test.go (about) 1 package tests 2 3 import ( 4 "errors" 5 "testing" 6 7 "github.com/ncruces/go-sqlite3" 8 _ "github.com/ncruces/go-sqlite3/embed" 9 _ "github.com/ncruces/go-sqlite3/tests/testcfg" 10 "github.com/ncruces/go-sqlite3/vfs/memdb" 11 "github.com/ncruces/go-sqlite3/vfs/readervfs" 12 ) 13 14 func TestMemoryVFS_Open_notfound(t *testing.T) { 15 memdb.Delete("demo.db") 16 17 _, err := sqlite3.Open("file:/demo.db?vfs=memdb&mode=ro") 18 if err == nil { 19 t.Error("want error") 20 } 21 if !errors.Is(err, sqlite3.CANTOPEN) { 22 t.Errorf("got %v, want sqlite3.CANTOPEN", err) 23 } 24 } 25 26 func TestReaderVFS_Open_notfound(t *testing.T) { 27 readervfs.Delete("demo.db") 28 29 _, err := sqlite3.Open("file:demo.db?vfs=reader") 30 if err == nil { 31 t.Error("want error") 32 } 33 if !errors.Is(err, sqlite3.CANTOPEN) { 34 t.Errorf("got %v, want sqlite3.CANTOPEN", err) 35 } 36 }