github.com/powerman/golang-tools@v0.1.11-0.20220410185822-5ad214d8d803/go/analysis/passes/asmdecl/asmdecl_test.go (about)

     1  // Copyright 2018 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 asmdecl_test
     6  
     7  import (
     8  	"os"
     9  	"strings"
    10  	"testing"
    11  
    12  	"github.com/powerman/golang-tools/go/analysis/analysistest"
    13  	"github.com/powerman/golang-tools/go/analysis/passes/asmdecl"
    14  )
    15  
    16  var goosarches = []string{
    17  	"linux/amd64",  // asm1.s, asm4.s
    18  	"linux/386",    // asm2.s
    19  	"linux/arm",    // asm3.s
    20  	"linux/mips64", // asm5.s
    21  	"linux/s390x",  // asm6.s
    22  	"linux/ppc64",  // asm7.s
    23  	"linux/mips",   // asm8.s,
    24  	"js/wasm",      // asm9.s
    25  }
    26  
    27  func Test(t *testing.T) {
    28  	testdata := analysistest.TestData()
    29  	for _, goosarch := range goosarches {
    30  		t.Run(goosarch, func(t *testing.T) {
    31  			i := strings.Index(goosarch, "/")
    32  			os.Setenv("GOOS", goosarch[:i])
    33  			os.Setenv("GOARCH", goosarch[i+1:])
    34  			analysistest.Run(t, testdata, asmdecl.Analyzer, "a")
    35  		})
    36  	}
    37  }