github.com/zxy12/go_duplicate_112_new@v0.0.0-20200807091221-747231827200/src/cmd/go/internal/modfetch/cache_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 modfetch
     6  
     7  import (
     8  	"io/ioutil"
     9  	"os"
    10  	"path/filepath"
    11  	"testing"
    12  )
    13  
    14  func TestWriteDiskCache(t *testing.T) {
    15  	tmpdir, err := ioutil.TempDir("", "go-writeCache-test-")
    16  	if err != nil {
    17  		t.Fatal(err)
    18  	}
    19  	defer os.RemoveAll(tmpdir)
    20  
    21  	err = writeDiskCache(filepath.Join(tmpdir, "file"), []byte("data"))
    22  	if err != nil {
    23  		t.Fatal(err)
    24  	}
    25  }