Source file 
src/cmd/link/script_test.go
     1  
     2  
     3  
     4  
     5  package main
     6  
     7  import (
     8  	"cmd/internal/script/scripttest"
     9  	"flag"
    10  	"internal/testenv"
    11  	"runtime"
    12  	"testing"
    13  )
    14  
    15  
    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  	doReplacement := true
    22  	switch runtime.GOOS {
    23  	case "wasip1", "js":
    24  		
    25  		
    26  		doReplacement = false
    27  	}
    28  	repls := []scripttest.ToolReplacement{}
    29  	if doReplacement {
    30  		if testLinker == "" {
    31  			t.Fatalf("testLinker not set, can't replace")
    32  		}
    33  		repls = []scripttest.ToolReplacement{
    34  			scripttest.ToolReplacement{
    35  				ToolName:        "link",
    36  				ReplacementPath: testLinker,
    37  				EnvVar:          "LINK_TEST_EXEC_LINKER=1",
    38  			},
    39  		}
    40  	}
    41  	scripttest.RunToolScriptTest(t, repls, "testdata/script", *fixReadme)
    42  }
    43  
View as plain text