Source file src/cmd/nm/script_test.go

     1  // Copyright 2026 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 main
     6  
     7  import (
     8  	"cmd/internal/script/scripttest"
     9  	"flag"
    10  	"internal/testenv"
    11  	"os"
    12  	"testing"
    13  )
    14  
    15  //go:generate go test cmd/nm -v -run=TestScript/README --fixreadme
    16  
    17  var fixReadme = flag.Bool("fixreadme", false, "if true, update README for script tests")
    18  
    19  func TestScript(t *testing.T) {
    20  	testenv.MustHaveGoBuild(t)
    21  
    22  	testExe, testExeErr := os.Executable()
    23  
    24  	repls := []scripttest.ToolReplacement{}
    25  	if testExeErr == nil {
    26  		repls = []scripttest.ToolReplacement{
    27  			scripttest.ToolReplacement{
    28  				ToolName:        "nm",
    29  				ReplacementPath: testExe,
    30  				EnvVar:          "GO_NMTEST_IS_NM=1",
    31  			},
    32  		}
    33  	}
    34  	scripttest.RunToolScriptTest(t, repls, "testdata/script", *fixReadme)
    35  }
    36  

View as plain text