Skip to content

Commit ee18198

Browse files
committed
adjust test error messages
Signed-off-by: leongross <[email protected]>
1 parent d910beb commit ee18198

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/os/truncate_test.go

+11-6
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,32 @@ package os_test
99
import (
1010
. "os"
1111
"path/filepath"
12+
"runtime"
1213
"testing"
1314
)
1415

1516
func TestTruncate(t *testing.T) {
17+
if runtime.GOOS == "windows" {
18+
t.Skip()
19+
}
20+
1621
tmpDir := t.TempDir()
17-
file := filepath.Join(tmpDir, "truncate_0x100")
22+
file := filepath.Join(tmpDir, "truncate_test")
1823

1924
fd, err := Create(file)
2025
if err != nil {
21-
t.Fatalf("create %q: %s", file, err)
26+
t.Fatalf("create %q: got %v, want nil", file, err)
2227
}
2328

2429
// truncate up to 0x100
2530
if err := fd.Truncate(0x100); err != nil {
26-
t.Fatalf("truncate %q: %s", file, err)
31+
t.Fatalf("truncate %q: got %v, want nil", file, err)
2732
}
2833

2934
// check if size is 0x100
3035
fi, err := Stat(file)
3136
if err != nil {
32-
t.Fatalf("stat %q: %s", file, err)
37+
t.Fatalf("stat %q: got %v, want nil", file, err)
3338
}
3439

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

3944
// truncate down to 0x80
4045
if err := fd.Truncate(0x80); err != nil {
41-
t.Fatalf("truncate %q: %s", file, err)
46+
t.Fatalf("truncate %q: got %v, want nil", file, err)
4247
}
4348

4449
// check if size is 0x80
4550
fi, err = Stat(file)
4651
if err != nil {
47-
t.Fatalf("stat %q: %s", file, err)
52+
t.Fatalf("stat %q: got %v, want nil", file, err)
4853
}
4954

5055
if fi.Size() != 0x80 {

0 commit comments

Comments
 (0)