Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(123)

Delta Between Two Patch Sets: src/pkg/syscall/syscall_windows_test.go

Issue 6261053: code review 6261053: syscall: correct Win32finddata definition (Closed)
Left Patch Set: diff -r 3524a4743246 https://go.googlecode.com/hg/ Created 11 years, 10 months ago
Right Patch Set: diff -r a2cb3130bd86 https://go.googlecode.com/hg/ Created 11 years, 10 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/syscall/syscall_windows.go ('k') | src/pkg/syscall/zsyscall_windows_386.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // Copyright 2012 The Go Authors. All rights reserved. 1 // Copyright 2012 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 package syscall_test 5 package syscall_test
6 6
7 import ( 7 import (
8 "io/ioutil" 8 "io/ioutil"
9 "os" 9 "os"
10 "path/filepath" 10 "path/filepath"
11 "syscall" 11 "syscall"
12 "testing" 12 "testing"
13 ) 13 )
14 14
15 func TestWin32finddata(t *testing.T) { 15 func TestWin32finddata(t *testing.T) {
16 dir, err := ioutil.TempDir("", "go-build") 16 dir, err := ioutil.TempDir("", "go-build")
17 if err != nil { 17 if err != nil {
18 t.Fatalf("failed to create temp directory: %v", err) 18 t.Fatalf("failed to create temp directory: %v", err)
19 } 19 }
20 defer os.RemoveAll(dir) 20 defer os.RemoveAll(dir)
21 21
22 path := filepath.Join(dir, "long_name.and_extension") 22 path := filepath.Join(dir, "long_name.and_extension")
23 f, err := os.Create(path) 23 f, err := os.Create(path)
24 if err != nil { 24 if err != nil {
25 t.Fatalf("failed to create %v: %v", path, err) 25 t.Fatalf("failed to create %v: %v", path, err)
26 } 26 }
27 f.Close() 27 f.Close()
28 28
29 type X struct { 29 type X struct {
30 » » fd syscall.Win32finddata 30 » » fd syscall.Win32finddata1
31 got byte 31 got byte
32 pad [10]byte // to protect ourselves 32 pad [10]byte // to protect ourselves
33 33
34 } 34 }
35 var want byte = 2 // it is unlikely to have this character in the filena me 35 var want byte = 2 // it is unlikely to have this character in the filena me
36 x := X{got: want} 36 x := X{got: want}
37 37
38 » h, err := syscall.FindFirstFile(syscall.StringToUTF16Ptr(path), &(x.fd)) 38 » h, err := syscall.FindFirstFile1(syscall.StringToUTF16Ptr(path), &(x.fd) )
39 if err != nil { 39 if err != nil {
40 t.Fatalf("FindFirstFile failed: %v", err) 40 t.Fatalf("FindFirstFile failed: %v", err)
41 } 41 }
42 err = syscall.FindClose(h) 42 err = syscall.FindClose(h)
43 if err != nil { 43 if err != nil {
44 t.Fatalf("FindClose failed: %v", err) 44 t.Fatalf("FindClose failed: %v", err)
45 } 45 }
46 46
47 if x.got != want { 47 if x.got != want {
48 t.Fatalf("memory corruption: want=%d got=%d", want, x.got) 48 t.Fatalf("memory corruption: want=%d got=%d", want, x.got)
49 } 49 }
50 } 50 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b