github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/kbfs/data/dir_entry_test.go (about)

     1  // Copyright 2016 Keybase Inc. All rights reserved.
     2  // Use of this source code is governed by a BSD
     3  // license that can be found in the LICENSE file.
     4  
     5  package data
     6  
     7  import (
     8  	"testing"
     9  
    10  	"github.com/keybase/client/go/kbfs/kbfscodec"
    11  	"github.com/keybase/go-codec/codec"
    12  )
    13  
    14  type dirEntryFuture struct {
    15  	DirEntry
    16  	kbfscodec.Extra
    17  }
    18  
    19  func (cof dirEntryFuture) toCurrent() DirEntry {
    20  	return cof.DirEntry
    21  }
    22  
    23  func (cof dirEntryFuture) ToCurrentStruct() kbfscodec.CurrentStruct {
    24  	return cof.toCurrent()
    25  }
    26  
    27  func makeFakeDirEntry(t *testing.T, typ EntryType, size uint64) DirEntry {
    28  	return DirEntry{
    29  		makeFakeBlockInfo(t),
    30  		EntryInfo{
    31  			typ,
    32  			size,
    33  			"fake sym path",
    34  			101,
    35  			102,
    36  			"",
    37  			nil,
    38  		},
    39  		codec.UnknownFieldSetHandler{},
    40  	}
    41  }
    42  
    43  func makeFakeDirEntryFuture(t *testing.T) dirEntryFuture {
    44  	cof := dirEntryFuture{
    45  		makeFakeDirEntry(t, Dir, 100),
    46  		kbfscodec.MakeExtraOrBust("dirEntry", t),
    47  	}
    48  	return cof
    49  }
    50  
    51  func TestDirEntryUnknownFields(t *testing.T) {
    52  	kbfscodec.TestStructUnknownFieldsMsgpack(t, makeFakeDirEntryFuture(t))
    53  }