golang.org/x/tools@v0.21.0/go/analysis/passes/httpmux/httpmux_test.go (about)

     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 httpmux
     6  
     7  import (
     8  	"testing"
     9  
    10  	"golang.org/x/tools/go/analysis/analysistest"
    11  )
    12  
    13  func Test(t *testing.T) {
    14  	testdata := analysistest.TestData()
    15  	tests := []string{"a"}
    16  	inTest = true
    17  	analysistest.Run(t, testdata, Analyzer, tests...)
    18  }
    19  
    20  func TestGoVersion(t *testing.T) {
    21  	for _, test := range []struct {
    22  		in   string
    23  		want bool
    24  	}{
    25  		{"", true},
    26  		{"go1", false},
    27  		{"go1.21", false},
    28  		{"go1.21rc3", false},
    29  		{"go1.22", true},
    30  		{"go1.22rc1", true},
    31  	} {
    32  		got := goVersionAfter121(test.in)
    33  		if got != test.want {
    34  			t.Errorf("%q: got %t, want %t", test.in, got, test.want)
    35  		}
    36  	}
    37  }