| 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 cipd | 5 package cipd |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "fmt" | 8 "fmt" |
| 9 "testing" | 9 "testing" |
| 10 | 10 |
| 11 "github.com/luci/luci-go/vpython/api/vpython" | 11 "github.com/luci/luci-go/vpython/api/vpython" |
| 12 | 12 |
| 13 . "github.com/smartystreets/goconvey/convey" | 13 . "github.com/smartystreets/goconvey/convey" |
| 14 ) | 14 ) |
| 15 | 15 |
| 16 func mkTag(arch string) *vpython.Pep425Tag { | 16 func mkTag(plat string) *vpython.PEP425Tag { |
| 17 » return &vpython.Pep425Tag{ | 17 » return &vpython.PEP425Tag{ |
| 18 » » Version: "cp27", | 18 » » Python: "cp27", |
| 19 » » Abi: "none", | 19 » » Abi: "none", |
| 20 » » Arch: arch, | 20 » » Platform: plat, |
| 21 } | 21 } |
| 22 } | 22 } |
| 23 | 23 |
| 24 func TestPlatformForPEP425Tag(t *testing.T) { | 24 func TestPlatformForPEP425Tag(t *testing.T) { |
| 25 t.Parallel() | 25 t.Parallel() |
| 26 | 26 |
| 27 testCases := []struct { | 27 testCases := []struct { |
| 28 » » tag *vpython.Pep425Tag | 28 » » tag *vpython.PEP425Tag |
| 29 platform string | 29 platform string |
| 30 }{ | 30 }{ |
| 31 {mkTag("junk_i686"), ""}, | 31 {mkTag("junk_i686"), ""}, |
| 32 | 32 |
| 33 {mkTag("linux_sparc64"), ""}, | 33 {mkTag("linux_sparc64"), ""}, |
| 34 {mkTag("linux_i686"), "linux-386"}, | 34 {mkTag("linux_i686"), "linux-386"}, |
| 35 {mkTag("manylinux1_i686"), "linux-386"}, | 35 {mkTag("manylinux1_i686"), "linux-386"}, |
| 36 {mkTag("linux_x86_64"), "linux-amd64"}, | 36 {mkTag("linux_x86_64"), "linux-amd64"}, |
| 37 {mkTag("manylinux1_x86_64"), "linux-amd64"}, | 37 {mkTag("manylinux1_x86_64"), "linux-amd64"}, |
| 38 {mkTag("linux_arm64"), "linux-arm64"}, | 38 {mkTag("linux_arm64"), "linux-arm64"}, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 53 } | 53 } |
| 54 | 54 |
| 55 Convey(`Testing PEP425 tag selection`, t, func() { | 55 Convey(`Testing PEP425 tag selection`, t, func() { |
| 56 for _, tc := range testCases { | 56 for _, tc := range testCases { |
| 57 Convey(fmt.Sprintf("Tag %q => %q", tc.tag.TagString(), t
c.platform), func() { | 57 Convey(fmt.Sprintf("Tag %q => %q", tc.tag.TagString(), t
c.platform), func() { |
| 58 So(PlatformForPEP425Tag(tc.tag), ShouldResemble,
tc.platform) | 58 So(PlatformForPEP425Tag(tc.tag), ShouldResemble,
tc.platform) |
| 59 }) | 59 }) |
| 60 } | 60 } |
| 61 }) | 61 }) |
| 62 } | 62 } |
| OLD | NEW |