summaryrefslogtreecommitdiff
path: root/libgo/go/os/user/user_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/os/user/user_test.go')
-rw-r--r--libgo/go/os/user/user_test.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/libgo/go/os/user/user_test.go b/libgo/go/os/user/user_test.go
index 9d8d94d8dae..b3aeed883cd 100644
--- a/libgo/go/os/user/user_test.go
+++ b/libgo/go/os/user/user_test.go
@@ -16,9 +16,6 @@ func checkUser(t *testing.T) {
}
func TestCurrent(t *testing.T) {
- if runtime.GOOS == "android" {
- t.Skipf("skipping on %s", runtime.GOOS)
- }
u, err := Current()
if err != nil {
t.Fatalf("Current: %v (got %#v)", err, u)
@@ -31,6 +28,12 @@ func TestCurrent(t *testing.T) {
}
}
+func BenchmarkCurrent(b *testing.B) {
+ for i := 0; i < b.N; i++ {
+ Current()
+ }
+}
+
func compare(t *testing.T, want, got *User) {
if want.Uid != got.Uid {
t.Errorf("got Uid=%q; want %q", got.Uid, want.Uid)
@@ -64,6 +67,9 @@ func TestLookup(t *testing.T) {
if err != nil {
t.Fatalf("Current: %v", err)
}
+ // TODO: Lookup() has a fast path that calls Current() and returns if the
+ // usernames match, so this test does not exercise very much. It would be
+ // good to try and test finding a different user than the current user.
got, err := Lookup(want.Username)
if err != nil {
t.Fatalf("Lookup: %v", err)