github.com/dhui/migrate@v3.4.0+incompatible/source/godoc_vfs/vfs_test.go (about)

     1  package godoc_vfs_test
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/golang-migrate/migrate/source/godoc_vfs"
     7  	st "github.com/golang-migrate/migrate/source/testing"
     8  	"golang.org/x/tools/godoc/vfs/mapfs"
     9  )
    10  
    11  func TestVFS(t *testing.T) {
    12  	fs := mapfs.New(map[string]string{
    13  		"1_foobar.up.sql":   "1 up",
    14  		"1_foobar.down.sql": "1 down",
    15  		"3_foobar.up.sql":   "3 up",
    16  		"4_foobar.up.sql":   "4 up",
    17  		"4_foobar.down.sql": "4 down",
    18  		"5_foobar.down.sql": "5 down",
    19  		"7_foobar.up.sql":   "7 up",
    20  		"7_foobar.down.sql": "7 down",
    21  	})
    22  
    23  	d, err := godoc_vfs.WithInstance(fs, "")
    24  	if err != nil {
    25  		t.Fatal(err)
    26  	}
    27  	st.Test(t, d)
    28  }
    29  
    30  func TestOpen(t *testing.T) {
    31  	defer func() {
    32  		if r := recover(); r == nil {
    33  			t.Error("Expected Open to panic")
    34  		}
    35  	}()
    36  	b := &godoc_vfs.VFS{}
    37  	b.Open("")
    38  }