]> Cypherpunks.ru repositories - gostls13.git/blob - src/cmd/compile/internal/types2/version_test.go
runtime: prevent send on closed channel in wakeableSleep
[gostls13.git] / src / cmd / compile / internal / types2 / version_test.go
1 // Copyright 2023 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.
4
5 package types2
6
7 import "testing"
8
9 var parseGoVersionTests = []struct {
10         in  string
11         out version
12 }{
13         {"go1.21", version{1, 21}},
14         {"go1.21.0", version{1, 21}},
15         {"go1.21rc2", version{1, 21}},
16 }
17
18 func TestParseGoVersion(t *testing.T) {
19         for _, tt := range parseGoVersionTests {
20                 if out, err := parseGoVersion(tt.in); out != tt.out || err != nil {
21                         t.Errorf("parseGoVersion(%q) = %v, %v, want %v, nil", tt.in, out, err, tt.out)
22                 }
23         }
24 }