| OLD | NEW |
| 1 // Copyright 2017 The LUCI Authors. All rights reserved. | 1 // Copyright 2017 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
| 4 | 4 |
| 5 package spec | 5 package spec |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "testing" | 8 "testing" |
| 9 | 9 |
| 10 "github.com/luci/luci-go/vpython/api/vpython" | 10 "github.com/luci/luci-go/vpython/api/vpython" |
| 11 | 11 |
| 12 . "github.com/luci/luci-go/common/testing/assertions" | 12 . "github.com/luci/luci-go/common/testing/assertions" |
| 13 . "github.com/smartystreets/goconvey/convey" | 13 . "github.com/smartystreets/goconvey/convey" |
| 14 ) | 14 ) |
| 15 | 15 |
| 16 func TestNormalizeAndHash(t *testing.T) { | 16 func TestNormalizeAndHash(t *testing.T) { |
| 17 t.Parallel() | 17 t.Parallel() |
| 18 | 18 |
| 19 » pkgFoo := &vpython.Spec_Package{Path: "foo", Version: "1"} | 19 » pkgFoo := &vpython.Spec_Package{Name: "foo", Version: "1"} |
| 20 » pkgBar := &vpython.Spec_Package{Path: "bar", Version: "2"} | 20 » pkgBar := &vpython.Spec_Package{Name: "bar", Version: "2"} |
| 21 » pkgBaz := &vpython.Spec_Package{Path: "baz", Version: "3"} | 21 » pkgBaz := &vpython.Spec_Package{Name: "baz", Version: "3"} |
| 22 | 22 |
| 23 Convey(`Test manifest generation`, t, func() { | 23 Convey(`Test manifest generation`, t, func() { |
| 24 var spec vpython.Spec | 24 var spec vpython.Spec |
| 25 | 25 |
| 26 Convey(`Will normalize an empty spec`, func() { | 26 Convey(`Will normalize an empty spec`, func() { |
| 27 So(Normalize(&spec), ShouldBeNil) | 27 So(Normalize(&spec), ShouldBeNil) |
| 28 So(spec, ShouldResemble, vpython.Spec{}) | 28 So(spec, ShouldResemble, vpython.Spec{}) |
| 29 }) | 29 }) |
| 30 | 30 |
| 31 Convey(`Will normalize to sorted order.`, func() { | 31 Convey(`Will normalize to sorted order.`, func() { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 43 So(Normalize(&spec), ShouldErrLike, "duplicate spec entr
ies") | 43 So(Normalize(&spec), ShouldErrLike, "duplicate spec entr
ies") |
| 44 | 44 |
| 45 // Even if the versions differ. | 45 // Even if the versions differ. |
| 46 fooClone := *pkgFoo | 46 fooClone := *pkgFoo |
| 47 fooClone.Version = "other" | 47 fooClone.Version = "other" |
| 48 spec.Wheel = []*vpython.Spec_Package{pkgFoo, &fooClone,
pkgBar, pkgBaz} | 48 spec.Wheel = []*vpython.Spec_Package{pkgFoo, &fooClone,
pkgBar, pkgBaz} |
| 49 So(Normalize(&spec), ShouldErrLike, "duplicate spec entr
ies") | 49 So(Normalize(&spec), ShouldErrLike, "duplicate spec entr
ies") |
| 50 }) | 50 }) |
| 51 }) | 51 }) |
| 52 } | 52 } |
| OLD | NEW |