-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
Implement new spec for `dep ensure`
- Loading branch information
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Copyright 2016 The Go Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package main | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/golang/dep/internal/gps" | ||
) | ||
|
||
func TestInvalidEnsureFlagCombinations(t *testing.T) { | ||
ec := &ensureCommand{ | ||
update: true, | ||
add: true, | ||
} | ||
|
||
if err := ec.validateFlags(); err == nil { | ||
t.Error("-add and -update together should fail validation") | ||
} | ||
|
||
ec.vendorOnly, ec.add = true, false | ||
if err := ec.validateFlags(); err == nil { | ||
t.Error("-vendor-only with -update should fail validation") | ||
} | ||
|
||
ec.add, ec.update = true, false | ||
if err := ec.validateFlags(); err == nil { | ||
t.Error("-vendor-only with -add should fail validation") | ||
} | ||
|
||
ec.noVendor, ec.add = true, false | ||
if err := ec.validateFlags(); err == nil { | ||
t.Error("-vendor-only with -no-vendor should fail validation") | ||
} | ||
ec.noVendor = false | ||
|
||
// Also verify that the plain ensure path takes no args. This is a shady | ||
// test, as lots of other things COULD return errors, and we don't check | ||
// anything other than the error being non-nil. For now, it works well | ||
// because a panic will quickly result if the initial arg length validation | ||
// checks are incorrectly handled. | ||
if err := ec.runDefault(nil, []string{"foo"}, nil, nil, gps.SolveParameters{}); err == nil { | ||
t.Errorf("no args to plain ensure with -vendor-only") | ||
} | ||
ec.vendorOnly = false | ||
if err := ec.runDefault(nil, []string{"foo"}, nil, nil, gps.SolveParameters{}); err == nil { | ||
t.Errorf("no args to plain ensure") | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
[[constraint]] | ||
branch = "master" | ||
name = "github.com/sdboyer/deptesttres" | ||
|
||
[[constraint]] | ||
name = "github.com/sdboyer/deptest" | ||
version = "0.8.1" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"commands": [ | ||
["init", "-no-examples"], | ||
["ensure", "-add", "github.com/sdboyer/deptest", "github.com/sdboyer/[email protected]"] | ||
], | ||
"vendor-final": [ | ||
"github.com/sdboyer/deptest", | ||
"github.com/sdboyer/deptesttres" | ||
] | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
|
||
[[constraint]] | ||
name = "github.com/sdboyer/deptest" | ||
version = "0.8.0" | ||
version = "1.0.0" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"commands": [ | ||
["init", "-no-examples"], | ||
["ensure", "-add", "github.com/sdboyer/deptesttres", "github.com/sdboyer/deptesttres/subp"] | ||
], | ||
"vendor-final": [ | ||
"github.com/sdboyer/deptest", | ||
"github.com/sdboyer/deptesttres" | ||
] | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
[[constraint]] | ||
branch = "master" | ||
name = "github.com/sdboyer/deptesttres" | ||
|
||
[[constraint]] | ||
name = "github.com/sdboyer/deptest" | ||
version = "0.8.1" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"commands": [ | ||
["init", "-no-examples"], | ||
["ensure", "-add", "github.com/sdboyer/[email protected]"] | ||
], | ||
"vendor-final": [ | ||
"github.com/sdboyer/deptest", | ||
"github.com/sdboyer/deptesttres" | ||
] | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
[[constraint]] | ||
branch = "master" | ||
name = "github.com/sdboyer/deptesttres" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright 2017 The Go Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package main | ||
|
||
import ( | ||
"github.com/sdboyer/deptesttres" | ||
) | ||
|
||
func main() { | ||
type a deptesttres.Bar | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"commands": [ | ||
["init", "-no-examples"], | ||
["ensure", "-add", "github.com/sdboyer/deptest"] | ||
], | ||
"vendor-final": [ | ||
"github.com/sdboyer/deptest", | ||
"github.com/sdboyer/deptesttres" | ||
] | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright 2016 The Go Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package main | ||
|
||
import ( | ||
"github.com/sdboyer/deptest" | ||
"github.com/sdboyer/deptestdos" | ||
) | ||
|
||
func main() { | ||
err := nil | ||
if err != nil { | ||
deptest.Map["yo yo!"] | ||
} | ||
deptestdos.diMeLo("whatev") | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"commands": [ | ||
["ensure", "-add", "foobar.com/baz"] | ||
], | ||
"error-expected": "Gopkg.toml and Gopkg.lock are out of sync. Run a plain dep ensure to resync them before attempting to -add" | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
[[constraint]] | ||
branch = "master" | ||
name = "github.com/sdboyer/deptesttres" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright 2017 The Go Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package main | ||
|
||
import ( | ||
"github.com/sdboyer/deptesttres" | ||
) | ||
|
||
func main() { | ||
type a deptesttres.Bar | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"commands": [ | ||
["init", "-no-examples"], | ||
["ensure", "-add", "github.com/sdboyer/[email protected]", "github.com/sdboyer/[email protected]"] | ||
], | ||
"vendor-final": [ | ||
"github.com/sdboyer/deptesttres" | ||
], | ||
"error-expected": "can only specify rules once per project being added; rules were given at least twice for github.com/sdboyer/deptest" | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[[constraint]] | ||
name = "github.com/sdboyer/deptesttres" | ||
branch = "master" | ||
|
||
[[constraint]] | ||
name = "github.com/sdboyer/deptest" | ||
version = "1.0.0" |