github.com/hanwen/go-fuse@v1.0.0/fuse/nodefs/files_test.go (about)

     1  // Copyright 2018 the Go-FUSE 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 nodefs
     6  
     7  import (
     8  	"io/ioutil"
     9  	"os"
    10  	"testing"
    11  	"time"
    12  
    13  	"github.com/hanwen/go-fuse/fuse"
    14  	"github.com/hanwen/go-fuse/internal/testutil"
    15  )
    16  
    17  // Check that loopbackFile.Utimens() works as expected
    18  func TestLoopbackFileUtimens(t *testing.T) {
    19  	f2, err := ioutil.TempFile("", "TestLoopbackFileUtimens")
    20  	if err != nil {
    21  		t.Fatal(err)
    22  	}
    23  	path := f2.Name()
    24  	defer os.Remove(path)
    25  	defer f2.Close()
    26  	f := NewLoopbackFile(f2)
    27  
    28  	utimensFn := func(atime *time.Time, mtime *time.Time) fuse.Status {
    29  		return f.Utimens(atime, mtime)
    30  	}
    31  	testutil.TestLoopbackUtimens(t, path, utimensFn)
    32  }