From f86c22bc0601ce00787703079ca62312403d31ef Mon Sep 17 00:00:00 2001 From: "Lixia (Sylvia) Lei" Date: Tue, 21 Jan 2025 20:19:39 +0800 Subject: [PATCH] cover tarfs Signed-off-by: Lixia (Sylvia) Lei --- internal/fs/tarfs/tarfs_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/fs/tarfs/tarfs_test.go b/internal/fs/tarfs/tarfs_test.go index e80df155..7c7bc588 100644 --- a/internal/fs/tarfs/tarfs_test.go +++ b/internal/fs/tarfs/tarfs_test.go @@ -82,6 +82,14 @@ func TestTarFS_Open_Success(t *testing.T) { t.Fatalf("TarFS.Open(%s) error = %v, wantErr %v", name, err, nil) } + fi, err := f.Stat() + if err != nil { + t.Fatalf("failed to get FileInfo for %s: %v", name, err) + } + if got, want := fi.Name(), filepath.Base(name); got != want { + t.Errorf("FileInfo.Name() = %v, want %v", got, want) + } + got, err := io.ReadAll(f) if err != nil { t.Fatalf("failed to read %s: %v", name, err)