Source file src/cmd/go/internal/modfetch/codehost/codehost_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 codehost
     6  
     7  import (
     8  	"testing"
     9  
    10  	"cmd/go/internal/vcscmd"
    11  )
    12  
    13  func TestRun(t *testing.T) {
    14  	dir := t.TempDir()
    15  	bad := vcscmd.New("fossil", "zip").Option("-R", "")
    16  	_, buildErr := bad.Build()
    17  	out, err := run(t.Context(), dir, bad)
    18  	runErr, ok := err.(*RunError)
    19  	if !ok || buildErr == nil || runErr.Err != buildErr || runErr.Cmd != "fossil zip in "+dir || out != nil {
    20  		t.Fatalf("run invalid command = %q, %#v; want build error with partial command", out, err)
    21  	}
    22  }
    23  

View as plain text