aboutsummaryrefslogtreecommitdiff
path: root/hotline/flattened_file_object_test.go
diff options
context:
space:
mode:
authorJeff Halter <868228+jhalter@users.noreply.github.com>2022-05-25 17:44:55 -0700
committerJeff Halter <868228+jhalter@users.noreply.github.com>2022-05-25 19:51:33 -0700
commit29f329aedcdcf4e07a6dc3d9161439dd35ecfe11 (patch)
tree9bc21e1e3ff6412f85af23fef7a885bafec8fe1e /hotline/flattened_file_object_test.go
parentc62f0b470f0ce33d5f52897f2cae7fd355f04b80 (diff)
Add partial support for file create/modify timestamps
This replaces hardcoded placeholder create/modify timestamps with the real times, mostly. Create time is OS specific, so for now I'm ignoring it at using the modify time as a stand-in.
Diffstat (limited to 'hotline/flattened_file_object_test.go')
-rw-r--r--hotline/flattened_file_object_test.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/hotline/flattened_file_object_test.go b/hotline/flattened_file_object_test.go
index 5bbaf1d..12b6d32 100644
--- a/hotline/flattened_file_object_test.go
+++ b/hotline/flattened_file_object_test.go
@@ -43,7 +43,7 @@ func TestNewFlattenedFileObject(t *testing.T) {
want: &flattenedFileObject{
FlatFileHeader: NewFlatFileHeader(),
FlatFileInformationForkHeader: FlatFileInformationForkHeader{},
- FlatFileInformationFork: NewFlatFileInformationFork("testfile.txt"),
+ FlatFileInformationFork: NewFlatFileInformationFork("testfile.txt", make([]byte, 8)),
FlatFileDataForkHeader: FlatFileDataForkHeader{
ForkType: []byte("DATA"),
CompressionType: []byte{0, 0, 0, 0},
@@ -67,9 +67,14 @@ func TestNewFlattenedFileObject(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got, err := NewFlattenedFileObject(tt.args.fileRoot, tt.args.filePath, tt.args.fileName)
- if !tt.wantErr(t, err, fmt.Sprintf("NewFlattenedFileObject(%v, %v, %v)", tt.args.fileRoot, tt.args.filePath, tt.args.fileName)) {
+ if tt.wantErr(t, err, fmt.Sprintf("NewFlattenedFileObject(%v, %v, %v)", tt.args.fileRoot, tt.args.filePath, tt.args.fileName)) {
return
}
+
+ // Clear the file timestamp fields to work around problems running the tests in multiple timezones
+ // TODO: revisit how to test this by mocking the stat calls
+ got.FlatFileInformationFork.CreateDate = make([]byte, 8)
+ got.FlatFileInformationFork.ModifyDate = make([]byte, 8)
assert.Equalf(t, tt.want, got, "NewFlattenedFileObject(%v, %v, %v)", tt.args.fileRoot, tt.args.filePath, tt.args.fileName)
})
}