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  var ErrPathEscapes = errPathEscapes
    13  
    14  func init() {
    15  	checkWrapErr = true
    16  }
    17  
    18  var ExportReadFileContents = readFileContents
    19  
    20  // cleanuper stands in for *testing.T, since we can't import testing in os.
    21  type cleanuper interface {
    22  	Cleanup(func())
    23  }
    24  
    25  func SetStatHook(t cleanuper, f func(f *File, name string) (FileInfo, error)) {
    26  	oldstathook := stathook
    27  	t.Cleanup(func() {
    28  		stathook = oldstathook
    29  	})
    30  	stathook = f
    31  }
    32  

View as plain text