github.com/insionng/yougam@v0.0.0-20170714101924-2bc18d833463/libraries/go-xorm/xorm/helpers_test.go (about)

     1  package xorm
     2  
     3  import "testing"
     4  
     5  func TestSplitTag(t *testing.T) {
     6  	var cases = []struct {
     7  		tag  string
     8  		tags []string
     9  	}{
    10  		{"not null default '2000-01-01 00:00:00' TIMESTAMP", []string{"not", "null", "default", "'2000-01-01 00:00:00'", "TIMESTAMP"}},
    11  		{"TEXT", []string{"TEXT"}},
    12  		{"default('2000-01-01 00:00:00')", []string{"default('2000-01-01 00:00:00')"}},
    13  		{"json  binary", []string{"json", "binary"}},
    14  	}
    15  
    16  	for _, kase := range cases {
    17  		tags := splitTag(kase.tag)
    18  		if !sliceEq(tags, kase.tags) {
    19  			t.Fatalf("[%d]%v is not equal [%d]%v", len(tags), tags, len(kase.tags), kase.tags)
    20  		}
    21  	}
    22  }