@@ -466,7 +466,7 @@ func TestStandardContext(t *testing.T) {
466466}
467467
468468func TestFileKey (t * testing.T ) {
469- os . Setenv ( "GAE_ENV" , "standard" )
469+ const firstGenTest = 0
470470 tests := []struct {
471471 mainPath string
472472 file string
@@ -499,6 +499,16 @@ func TestFileKey(t *testing.T) {
499499 filepath .FromSlash ("/tmp/staging3234/srv/_gopath/src/example.com/bar/main.go" ),
500500 filepath .FromSlash ("example.com/bar/main.go" ),
501501 },
502+ {
503+ filepath .FromSlash ("/tmp/staging3234/srv/gopath/src/example.com/foo" ),
504+ filepath .FromSlash ("/tmp/staging3234/srv/gopath/src/example.com/bar/main.go" ),
505+ filepath .FromSlash ("example.com/bar/main.go" ),
506+ },
507+ {
508+ filepath .FromSlash ("" ),
509+ filepath .FromSlash ("/tmp/staging3234/srv/gopath/src/example.com/bar/main.go" ),
510+ filepath .FromSlash ("example.com/bar/main.go" ),
511+ },
502512 // go mod, same package
503513 {
504514 filepath .FromSlash ("/tmp/staging3234/srv" ),
@@ -520,6 +530,11 @@ func TestFileKey(t *testing.T) {
520530 filepath .FromSlash ("/tmp/staging3234/srv/bar/main.go" ),
521531 filepath .FromSlash ("bar/main.go" ),
522532 },
533+ {
534+ filepath .FromSlash ("" ),
535+ filepath .FromSlash ("/tmp/staging3234/srv/bar/main.go" ),
536+ filepath .FromSlash ("bar/main.go" ),
537+ },
523538 // go mod, other package
524539 {
525540 filepath .FromSlash ("/tmp/staging3234/srv" ),
@@ -528,6 +543,9 @@ func TestFileKey(t *testing.T) {
528543 },
529544 }
530545 for i , tc := range tests {
546+ if i > firstGenTest {
547+ os .Setenv ("GAE_ENV" , "standard" )
548+ }
531549 internal .MainPath = tc .mainPath
532550 got , err := fileKey (tc .file )
533551 if err != nil {
0 commit comments