Black Lives Matter. Support the Equal Justice Initiative.

Text file src/cmd/go/testdata/script/test_relative_import_dash_i.txt

Documentation: cmd/go/testdata/script

     1  # Relative imports in go test -i
     2  env GO111MODULE=off # relative import not supported in module mode
     3  
     4  # Run tests outside GOPATH.
     5  env GOPATH=$WORK/tmp
     6  
     7  # Check that it's safe to pass -i (which installs dependencies in $GOPATH/pkg) to go test.
     8  ! stale runtime # don't let test -i overwrite runtime
     9  go test -i ./testimport
    10  
    11  -- testimport/p.go --
    12  package p
    13  
    14  func F() int { return 1 }
    15  -- testimport/p1/p1.go --
    16  package p1
    17  
    18  func F() int { return 1 }
    19  -- testimport/p_test.go --
    20  package p
    21  
    22  import (
    23  	"./p1"
    24  
    25  	"testing"
    26  )
    27  
    28  func TestF(t *testing.T) {
    29  	if F() != p1.F() {
    30  		t.Fatal(F())
    31  	}
    32  }
    33  

View as plain text