github.com/amarpal/go-tools@v0.0.0-20240422043104-40142f59f616/staticcheck/sa1019/testdata/src/example.com/CheckDeprecated/external_test.go (about)

     1  // Deprecated: deprecating external test packages is silly but possible.
     2  package pkg_test
     3  
     4  import (
     5  	"testing"
     6  
     7  	// External tests can import deprecated packages under test.
     8  	pkg "example.com/CheckDeprecated"
     9  )
    10  
    11  // Deprecated: deprecating tests is silly but possible.
    12  func TestFoo(t *testing.T) {
    13  }
    14  
    15  // This test isn't deprecated, to test that s.Field doesn't get flagged because it's from the package under test. If
    16  // TestBar was itself deprecated, it could use any deprecated objects it wanted.
    17  func TestBar(t *testing.T) {
    18  	var s pkg.S
    19  	// External tests can use deprecated objects from the package under test
    20  	_ = s.Field
    21  }