github.com/reggieriser/pop@v4.13.1+incompatible/columns/tags_test.go (about)

     1  package columns_test
     2  
     3  import (
     4  	"reflect"
     5  	"testing"
     6  
     7  	"github.com/gobuffalo/pop/columns"
     8  
     9  	"github.com/stretchr/testify/require"
    10  )
    11  
    12  func Test_Tags_TagsFor(t *testing.T) {
    13  	r := require.New(t)
    14  
    15  	typ := reflect.TypeOf(foo{})
    16  	f, _ := typ.FieldByName("FirstName")
    17  	tags := columns.TagsFor(f)
    18  
    19  	r.Equal(len(tags), 2)
    20  	r.Equal(tags.Find("db").Value, "first_name")
    21  	r.Equal(tags.Find("select").Value, "first_name as f")
    22  }