You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: visiblefields_test.go
    path of file: ./repos/gccrs/libgo/go/reflect
    
    the code of the file until where you have to start completion: // Copyright 2021 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that ca
    
func TestFields(t *testing.T) {
	for _, test := range fieldsTests {
		test := test
		t.Run(test.testName, func(t *testing.T) {
			typ := TypeOf(test.val)
			fields := VisibleFields(typ)
			if got, want := len(fields), len(test.expect); got != want {
				t.Fatalf("unexpected field count; got %d want %d", got, want)
			}

			for j, field := range fields {
				expect := test.expect[j]
				t.Logf("field %d: %s", j, expect.name)
				gotField := typ.FieldByIndex(field.Index)
				// Unfortunately, FieldByIndex does not return
				// a field with the same index that we passed in,
				// so we set it to the expected value so that
				// it can be compared later with the result of FieldByName.
				gotField.Index = field.Index
				expectField := typ.FieldByIndex(expect.index)
				// ditto.
				expectField.Index = expect.index
				if !DeepEqual(gotField, expectField) {
					t.Fatalf("unexpected field result\ngot %#v\nwant %#v", gotField, expectField)
				}

				// Sanity check that we can actually access the field by the
				// expected name.
				gotField1, ok := typ.FieldByName(expect.name)
				if !ok {
					t.Fatalf("field %q not accessible by name", expect.name)
				}
				if !DeepEqual(gotField1, expectField) {
					t.Fatalf("unexpected FieldByName result; got %#v want %#v", gotField1, expectField)
				}
			}
		})
	}
}