github.com/ncruces/go-sqlite3@v0.15.1-0.20240520133447-53eef1510ff0/internal/util/reflect_test.go (about)

     1  package util
     2  
     3  import (
     4  	"fmt"
     5  	"math"
     6  	"reflect"
     7  	"testing"
     8  )
     9  
    10  func TestReflectType(t *testing.T) {
    11  	tests := []any{nil, 1, math.Pi, "abc"}
    12  	for _, tt := range tests {
    13  		t.Run(fmt.Sprint(tt), func(t *testing.T) {
    14  			want := fmt.Sprintf("%T", tt)
    15  			got := fmt.Sprintf("%v", ReflectType(reflect.ValueOf(tt)))
    16  			if got != want {
    17  				t.Errorf("ReflectType() = %v, want %v", got, want)
    18  			}
    19  		})
    20  	}
    21  }