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

Delta Between Two Patch Sets: src/pkg/os/user/user_test.go

Issue 5416060: code review 5416060: io: new FileInfo, FileMode types + update tree (Closed)
Left Patch Set: Created 13 years, 4 months ago
Right Patch Set: diff -r d917a203b389 https://go.googlecode.com/hg/ Created 13 years, 3 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:
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/os/types.go ('k') | src/pkg/path/filepath/match.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
(no file at all)
1 // Copyright 2011 The Go Authors. All rights reserved. 1 // Copyright 2011 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 user 5 package user
6 6
7 import ( 7 import (
8 "os" 8 "os"
9 "reflect" 9 "reflect"
10 "runtime" 10 "runtime"
(...skipping 23 matching lines...) Expand all
34 // Test LookupId on the current user 34 // Test LookupId on the current user
35 uid := syscall.Getuid() 35 uid := syscall.Getuid()
36 u, err := LookupId(uid) 36 u, err := LookupId(uid)
37 if err != nil { 37 if err != nil {
38 t.Fatalf("LookupId: %v", err) 38 t.Fatalf("LookupId: %v", err)
39 } 39 }
40 if e, g := uid, u.Uid; e != g { 40 if e, g := uid, u.Uid; e != g {
41 t.Errorf("expected Uid of %d; got %d", e, g) 41 t.Errorf("expected Uid of %d; got %d", e, g)
42 } 42 }
43 fi, err := os.Stat(u.HomeDir) 43 fi, err := os.Stat(u.HomeDir)
44 » if err != nil || !fi.IsDirectory() { 44 » if err != nil || !fi.IsDir() {
45 » » t.Errorf("expected a valid HomeDir; stat(%q): err=%v, IsDirector y=%v", u.HomeDir, err, fi.IsDirectory()) 45 » » t.Errorf("expected a valid HomeDir; stat(%q): err=%v, IsDir=%v", u.HomeDir, err, fi.IsDir())
46 } 46 }
47 if u.Username == "" { 47 if u.Username == "" {
48 t.Fatalf("didn't get a username") 48 t.Fatalf("didn't get a username")
49 } 49 }
50 50
51 // Test Lookup by username, using the username from LookupId 51 // Test Lookup by username, using the username from LookupId
52 un, err := Lookup(u.Username) 52 un, err := Lookup(u.Username)
53 if err != nil { 53 if err != nil {
54 t.Fatalf("Lookup: %v", err) 54 t.Fatalf("Lookup: %v", err)
55 } 55 }
56 if !reflect.DeepEqual(u, un) { 56 if !reflect.DeepEqual(u, un) {
57 t.Errorf("Lookup by userid vs. name didn't match\n"+ 57 t.Errorf("Lookup by userid vs. name didn't match\n"+
58 "LookupId(%d): %#v\n"+ 58 "LookupId(%d): %#v\n"+
59 "Lookup(%q): %#v\n", uid, u, u.Username, un) 59 "Lookup(%q): %#v\n", uid, u, u.Username, un)
60 } 60 }
61 } 61 }
LEFTRIGHT

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