1 // Copyright 2011 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
9 var selectTagTestTags
= []string{
16 "go.weekly.2010-01-02",
17 "go.weekly.2011-10-12",
18 "go.weekly.2011-10-12.1",
19 "go.weekly.2011-10-14",
20 "go.weekly.2011-11-01",
27 // these should be ignored:
32 "weekly.2011-10-12.1",
49 var selectTagTests
= []struct {
55 {"release.r58.2", "go.r58.1"},
56 {"release.r59", "go.r59"},
57 {"release.r59.1", "go.r59.1"},
58 {"release.r60", "go.r59.1"},
59 {"release.r60.1", "go.r59.1"},
60 {"release.r61", "go.r61"},
61 {"release.r66", "go.r61.1"},
62 {"weekly.2010-01-01", ""},
63 {"weekly.2010-01-02", "go.weekly.2010-01-02"},
64 {"weekly.2010-01-02.1", "go.weekly.2010-01-02"},
65 {"weekly.2010-01-03", "go.weekly.2010-01-02"},
66 {"weekly.2011-10-12", "go.weekly.2011-10-12"},
67 {"weekly.2011-10-12.1", "go.weekly.2011-10-12.1"},
68 {"weekly.2011-10-13", "go.weekly.2011-10-12.1"},
69 {"weekly.2011-10-14", "go.weekly.2011-10-14"},
70 {"weekly.2011-10-14.1", "go.weekly.2011-10-14"},
71 {"weekly.2011-11-01", "go.weekly.2011-11-01"},
72 {"weekly.2014-01-01", "go.weekly.2011-11-01"},
73 {"weekly.3000-01-01", "go.weekly.2011-11-01"},
76 {"go1.998", "go1.9.2"},
77 {"go1.1000", "go1.999"},
82 {"weekly.1999-01-01", ""},
86 {"go200000000000", ""},
93 func TestSelectTag(t
*testing
.T
) {
94 for _
, c
:= range selectTagTests
{
95 selected
:= selectTag(c
.version
, selectTagTestTags
)
96 if selected
!= c
.selected
{
97 t
.Errorf("selectTag(%q) = %q, want %q", c
.version
, selected
, c
.selected
)