github.com/fengyoulin/inspect@v0.2.1/inspect_test.go (about)

     1  package inspect_test
     2  
     3  import (
     4  	"github.com/fengyoulin/inspect"
     5  	"testing"
     6  )
     7  
     8  func TestTypeOf(t *testing.T) {
     9  	typ := inspect.TypeOf("runtime.g")
    10  	if typ == nil {
    11  		t.Error("runtime.g not found")
    12  	}
    13  	typ = inspect.TypeOf("*runtime.g")
    14  	if typ == nil {
    15  		t.Error("*runtime.g not found")
    16  	}
    17  }
    18  
    19  func TestTypes(t *testing.T) {
    20  	ts := inspect.Types()
    21  	if len(ts) == 0 || len(ts[0]) == 0 {
    22  		t.Error("get types failed")
    23  	}
    24  }