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

     1  # Setup
     2  env GO111MODULE=off
     3  mkdir $WORK/tmp/testdata/src/xtestonly
     4  cp f.go $WORK/tmp/testdata/src/xtestonly/f.go
     5  cp f_test.go $WORK/tmp/testdata/src/xtestonly/f_test.go
     6  env GOPATH=$WORK/tmp/testdata
     7  cd $WORK
     8  
     9  # Check output of go list to ensure no duplicates
    10  go list xtestonly ./tmp/testdata/src/xtestonly/...
    11  cmp stdout $WORK/gopath/src/wantstdout
    12  
    13  -- wantstdout --
    14  xtestonly
    15  -- f.go --
    16  package xtestonly
    17  
    18  func F() int { return 42 }
    19  -- f_test.go --
    20  package xtestonly_test
    21  
    22  import (
    23  	"testing"
    24  	"xtestonly"
    25  )
    26  
    27  func TestF(t *testing.T) {
    28  	if x := xtestonly.F(); x != 42 {
    29  		t.Errorf("f.F() = %d, want 42", x)
    30  	}
    31  }
    32  

View as plain text