Commit 90aa56f2 authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

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
parent b2c61168
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
package user package user
import ( import (
"os"
"runtime" "runtime"
"testing" "testing"
) )
...@@ -34,12 +33,11 @@ func TestCurrent(t *testing.T) { ...@@ -34,12 +33,11 @@ func TestCurrent(t *testing.T) {
if err != nil { if err != nil {
t.Fatalf("Current: %v", err) t.Fatalf("Current: %v", err)
} }
fi, err := os.Stat(u.HomeDir) if u.HomeDir == "" {
if err != nil || !fi.IsDir() { t.Errorf("didn't get a HomeDir")
t.Errorf("expected a valid HomeDir; stat(%q): err=%v", u.HomeDir, err)
} }
if u.Username == "" { if u.Username == "" {
t.Fatalf("didn't get a username") t.Errorf("didn't get a username")
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment