github.com/avfs/avfs@v0.33.1-0.20240303173310-c6ba67c33eb7/vfs/orefafs/orefafs_test.go (about) 1 // 2 // Copyright 2020 The AVFS authors 3 // 4 // Licensed under the Apache License, Version 2.0 (the "License"); 5 // you may not use this file except in compliance with the License. 6 // You may obtain a copy of the License at 7 // 8 // http://www.apache.org/licenses/LICENSE-2.0 9 // 10 // Unless required by applicable law or agreed to in writing, software 11 // distributed under the License is distributed on an "AS IS" BASIS, 12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 // See the License for the specific language governing permissions and 14 // limitations under the License. 15 // 16 17 //go:build !avfs_race 18 19 package orefafs_test 20 21 import ( 22 "io/fs" 23 "testing" 24 25 "github.com/avfs/avfs" 26 "github.com/avfs/avfs/test" 27 "github.com/avfs/avfs/vfs/orefafs" 28 ) 29 30 var ( 31 // Tests that orefafs.OrefaFS struct implements avfs.VFS interface. 32 _ avfs.VFS = &orefafs.OrefaFS{} 33 34 // Tests that orefafs.OrefaFile struct implements avfs.File interface. 35 _ avfs.File = &orefafs.OrefaFile{} 36 37 // Tests that orefafs.OrefaInfo struct implements fs.DirEntry interface. 38 _ fs.DirEntry = &orefafs.OrefaInfo{} 39 40 // Tests that orefafs.OrefaInfo struct implements fs.FileInfo interface. 41 _ fs.FileInfo = &orefafs.OrefaInfo{} 42 43 // Tests that orefafs.OrefaInfo struct implements avfs.SysStater interface. 44 _ avfs.SysStater = &orefafs.OrefaInfo{} 45 ) 46 47 func TestOrefaFS(t *testing.T) { 48 vfs := orefafs.New() 49 50 wantFeatures := avfs.FeatHardlink 51 if vfs.Features() != wantFeatures { 52 t.Errorf("Features : want Features to be %s, got %s", wantFeatures.String(), vfs.Features()) 53 } 54 55 ts := test.NewSuiteFS(t, vfs, vfs) 56 ts.TestVFSAll(t) 57 } 58 59 func TestOrefaFSNilPtrFile(t *testing.T) { 60 f := (*orefafs.OrefaFile)(nil) 61 62 test.FileNilPtr(t, f) 63 } 64 65 func BenchmarkOrefaFSAll(b *testing.B) { 66 vfs := orefafs.New() 67 68 ts := test.NewSuiteFS(b, vfs, vfs) 69 ts.BenchAll(b) 70 }