Skip to content

Commit

Permalink
adjust test error messages
Browse files Browse the repository at this point in the history
Signed-off-by: leongross <leon.gross@9elements.com>
  • Loading branch information
leongross committed Apr 4, 2024
1 parent d910beb commit ee18198
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/os/truncate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,32 @@ package os_test
import (
. "os"
"path/filepath"
"runtime"
"testing"
)

func TestTruncate(t *testing.T) {
if runtime.GOOS == "windows" {
t.Skip()
}

tmpDir := t.TempDir()
file := filepath.Join(tmpDir, "truncate_0x100")
file := filepath.Join(tmpDir, "truncate_test")

fd, err := Create(file)
if err != nil {
t.Fatalf("create %q: %s", file, err)
t.Fatalf("create %q: got %v, want nil", file, err)
}

// truncate up to 0x100
if err := fd.Truncate(0x100); err != nil {
t.Fatalf("truncate %q: %s", file, err)
t.Fatalf("truncate %q: got %v, want nil", file, err)
}

// check if size is 0x100
fi, err := Stat(file)
if err != nil {
t.Fatalf("stat %q: %s", file, err)
t.Fatalf("stat %q: got %v, want nil", file, err)
}

if fi.Size() != 0x100 {
Expand All @@ -38,13 +43,13 @@ func TestTruncate(t *testing.T) {

// truncate down to 0x80
if err := fd.Truncate(0x80); err != nil {
t.Fatalf("truncate %q: %s", file, err)
t.Fatalf("truncate %q: got %v, want nil", file, err)
}

// check if size is 0x80
fi, err = Stat(file)
if err != nil {
t.Fatalf("stat %q: %s", file, err)
t.Fatalf("stat %q: got %v, want nil", file, err)
}

if fi.Size() != 0x80 {
Expand Down

0 comments on commit ee18198

Please sign in to comment.