# Ensure buildinfo is populated on test binaries even if they
# are not tests for package main. See issue #33976.

[short] skip 'invokes go test'

go mod init foo
go test -v
stdout '(devel)'

-- foo_test.go --
package foo_test

import (
        "runtime/debug"
        "testing"
)

func TestBuildInfo(t *testing.T) {
        info, ok := debug.ReadBuildInfo()
        if !ok {
                t.Fatal("no debug info")
        }
        t.Log(info.Main.Version)
}