Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

Commit

Permalink
Fully embrace subtests; remove hacky targeting arg
Browse files Browse the repository at this point in the history
  • Loading branch information
sdboyer committed Jul 20, 2017
1 parent e1fcbe4 commit 98f1d99
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 44 deletions.
66 changes: 23 additions & 43 deletions internal/gps/solve_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package gps

import (
"bytes"
"flag"
"fmt"
"io/ioutil"
"log"
Expand All @@ -21,13 +20,6 @@ import (
"github.com/golang/dep/internal/gps/pkgtree"
)

var fixtorun string

// TODO(sdboyer) regression test ensuring that locks with only revs for projects don't cause errors
func init() {
flag.StringVar(&fixtorun, "gps.fix", "", "A single fixture to run in TestBasicSolves or TestBimodalSolves")
}

// overrideMkBridge overrides the base bridge with the depspecBridge that skips
// verifyRootDir calls
func overrideMkBridge(s *solver, sm SourceManager, down bool) sourceBridge {
Expand Down Expand Up @@ -74,24 +66,18 @@ func fixSolve(params SolveParameters, sm SourceManager, t *testing.T) (Solution,
//
// Or, just the one named in the fix arg.
func TestBasicSolves(t *testing.T) {
if fixtorun != "" {
if fix, exists := basicFixtures[fixtorun]; exists {
solveBasicsAndCheck(fix, t)
}
} else {
// sort them by their keys so we get stable output
var names []string
for n := range basicFixtures {
names = append(names, n)
}
// sort them by their keys so we get stable output
names := make([]string, 0, len(basicFixtures))
for n := range basicFixtures {
names = append(names, n)
}

sort.Strings(names)
for _, n := range names {
t.Run(n, func(t *testing.T) {
//t.Parallel() // until trace output is fixed in parallel
solveBasicsAndCheck(basicFixtures[n], t)
})
}
sort.Strings(names)
for _, n := range names {
t.Run(n, func(t *testing.T) {
t.Parallel()
solveBasicsAndCheck(basicFixtures[n], t)
})
}
}

Expand Down Expand Up @@ -122,24 +108,18 @@ func solveBasicsAndCheck(fix basicFixture, t *testing.T) (res Solution, err erro
//
// Or, just the one named in the fix arg.
func TestBimodalSolves(t *testing.T) {
if fixtorun != "" {
if fix, exists := bimodalFixtures[fixtorun]; exists {
solveBimodalAndCheck(fix, t)
}
} else {
// sort them by their keys so we get stable output
var names []string
for n := range bimodalFixtures {
names = append(names, n)
}

sort.Strings(names)
for _, n := range names {
t.Run(n, func(t *testing.T) {
//t.Parallel() // until trace output is fixed in parallel
solveBimodalAndCheck(bimodalFixtures[n], t)
})
}
// sort them by their keys so we get stable output
names := make([]string, 0, len(bimodalFixtures))
for n := range bimodalFixtures {
names = append(names, n)
}

sort.Strings(names)
for _, n := range names {
t.Run(n, func(t *testing.T) {
t.Parallel()
solveBimodalAndCheck(bimodalFixtures[n], t)
})
}
}

Expand Down
3 changes: 2 additions & 1 deletion txn_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ type SafeWriter struct {
writeVendor bool
}

// NewSafeWriter sets up a SafeWriter to write a set of config yaml, lock and vendor tree.
// NewSafeWriter sets up a SafeWriter to write a set of manifest, lock, and
// vendor tree.
//
// - If manifest is provided, it will be written to the standard manifest file
// name beneath root.
Expand Down

0 comments on commit 98f1d99

Please sign in to comment.