зеркало из https://github.com/golang/dep.git
add tests for deduceConstraint
Signed-off-by: Jess Frazelle <acidburn@google.com>
This commit is contained in:
Родитель
fc2f693bec
Коммит
07c6fd6bf2
|
@ -5,6 +5,8 @@ import (
|
|||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/sdboyer/gps"
|
||||
)
|
||||
|
||||
func TestEnsureOverrides(t *testing.T) {
|
||||
|
@ -88,6 +90,26 @@ func main() {
|
|||
}
|
||||
}
|
||||
|
||||
func TestDeduceConstraint(t *testing.T) {
|
||||
sv, err := gps.NewSemverConstraint("v1.2.3")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
constraints := map[string]gps.Constraint{
|
||||
"v1.2.3": sv,
|
||||
"5b3352dc16517996fb951394bcbbe913a2a616e3": gps.Revision("5b3352dc16517996fb951394bcbbe913a2a616e3"),
|
||||
"g4@golang.org-20161116211307-wiuilyamo9ian0m7": gps.NewVersion("g4@golang.org-20161116211307-wiuilyamo9ian0m7"),
|
||||
}
|
||||
|
||||
for str, expected := range constraints {
|
||||
c := deduceConstraint(str)
|
||||
if c != expected {
|
||||
t.Fatalf("expected: %#v, got %#v for %s", expected, c, str)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestCopyFolder(t *testing.T) {
|
||||
dir, err := ioutil.TempDir("", "dep")
|
||||
if err != nil {
|
||||
|
|
Загрузка…
Ссылка в новой задаче