1
0
mirror of https://github.com/golang/go synced 2024-11-20 03:54:40 -07:00

os/user: simplify test

Don't require the home directory to exist. Just check
that it returns something.

Fixes #3531

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/6056045
This commit is contained in:
Brad Fitzpatrick 2012-04-17 18:46:35 -07:00
parent b2c6116843
commit 90aa56f271

View File

@ -5,7 +5,6 @@
package user
import (
"os"
"runtime"
"testing"
)
@ -34,12 +33,11 @@ func TestCurrent(t *testing.T) {
if err != nil {
t.Fatalf("Current: %v", err)
}
fi, err := os.Stat(u.HomeDir)
if err != nil || !fi.IsDir() {
t.Errorf("expected a valid HomeDir; stat(%q): err=%v", u.HomeDir, err)
if u.HomeDir == "" {
t.Errorf("didn't get a HomeDir")
}
if u.Username == "" {
t.Fatalf("didn't get a username")
t.Errorf("didn't get a username")
}
}