github.com/dannin/go@v0.0.0-20161031215817-d35dfd405eaa/src/cmd/go/build_test.go (about)

     1  // Copyright 2016 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  	"os"
     9  	"testing"
    10  )
    11  
    12  func TestRemoveDevNull(t *testing.T) {
    13  	fi, err := os.Lstat(os.DevNull)
    14  	if err != nil {
    15  		t.Skip(err)
    16  	}
    17  	if fi.Mode().IsRegular() {
    18  		t.Errorf("Lstat(%s).Mode().IsRegular() = true; expected false", os.DevNull)
    19  	}
    20  	mayberemovefile(os.DevNull)
    21  	_, err = os.Lstat(os.DevNull)
    22  	if err != nil {
    23  		t.Errorf("mayberemovefile(%s) did remove it; oops", os.DevNull)
    24  	}
    25  }