Source file src/cmd/internal/obj/link_test.go

     1  // Copyright 2026 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package obj
     6  
     7  import "testing"
     8  
     9  func TestIsGoType(t *testing.T) {
    10  	for _, tc := range []struct {
    11  		name string
    12  		want bool
    13  	}{
    14  		{"type:int", true},
    15  		{"type:main.Info", true},
    16  		{"type:*main.Info", true},
    17  		{"type:.eqfunc.EE", false},
    18  		{"type:.hashfunc.8", false},
    19  		{"type:.namedata.foo", false},
    20  		{"type:", false},
    21  		{"type", false},
    22  		{"go:itab.main.T,main.I", false},
    23  		{"main.f", false},
    24  		{"", false},
    25  	} {
    26  		s := &LSym{Name: tc.name}
    27  		if got := s.IsGoType(); got != tc.want {
    28  			t.Errorf("(&LSym{Name: %q}).IsGoType() = %v, want %v", tc.name, got, tc.want)
    29  		}
    30  	}
    31  }
    32  

View as plain text