]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/cover: add go.mod file in lineDupDir
authorBryan C. Mills <bcmills@google.com>
Fri, 15 Mar 2019 12:32:16 +0000 (08:32 -0400)
committerBryan C. Mills <bcmills@google.com>
Fri, 15 Mar 2019 13:00:24 +0000 (13:00 +0000)
This fixes TestFuncWithDuplicateLines (introduced in CL 167257)
in module mode.

Updates #30746
Updates #30228

Change-Id: I7b3e7192ae23f855c373e881389874ff6ffd49ad
Reviewed-on: https://go-review.googlesource.com/c/go/+/167740
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
src/cmd/cover/cover_test.go

index a53660f74434dd1f40e109900e723cd65f26069c..bac448cd47e6242b200442034f0e31e5526cb604 100644 (file)
@@ -540,6 +540,9 @@ func TestFuncWithDuplicateLines(t *testing.T) {
                t.Fatal(err)
        }
 
+       if err := ioutil.WriteFile(filepath.Join(lineDupDir, "go.mod"), []byte("module linedup\n"), 0444); err != nil {
+               t.Fatal(err)
+       }
        if err := ioutil.WriteFile(lineDupGo, []byte(lineDupContents), 0444); err != nil {
                t.Fatal(err)
        }
@@ -554,7 +557,7 @@ func TestFuncWithDuplicateLines(t *testing.T) {
 
        // testcover -func=TMPDIR/linedup.out
        cmd = exec.Command(testcover, "-func", lineDupProfile)
-       cmd.Dir = testTempDir
+       cmd.Dir = lineDupDir
        run(cmd, t)
 }