Source file src/os/export_test.go

     1  // Copyright 2011 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 os
     6  
     7  // Export for testing.
     8  
     9  var Atime = atime
    10  var ErrWriteAtInAppendMode = errWriteAtInAppendMode
    11  var ErrPatternHasSeparator = errPatternHasSeparator
    12  
    13  func init() {
    14  	checkWrapErr = true
    15  }
    16  
    17  var ExportReadFileContents = readFileContents
    18  
    19  // cleanuper stands in for *testing.T, since we can't import testing in os.
    20  type cleanuper interface {
    21  	Cleanup(func())
    22  }
    23  
    24  func SetStatHook(t cleanuper, f func(f *File, name string) (FileInfo, error)) {
    25  	oldstathook := stathook
    26  	t.Cleanup(func() {
    27  		stathook = oldstathook
    28  	})
    29  	stathook = f
    30  }
    31  

View as plain text