44package main
55
66import (
7- "testing"
87 "os/user"
8+ "testing"
99)
1010
1111// Usernames must not contain a number sign.
12- func TestEmptyString (t * testing.T ) {
12+ func TestEmptyString (t * testing.T ) {
1313 if chuser ("" ) == nil {
1414 t .Fatal ("the empty string is not a valid user" )
1515 }
1616}
1717
1818// Either omit delimiter and group, or omit both.
19- func TestEmptyGroup (t * testing.T ) {
19+ func TestEmptyGroup (t * testing.T ) {
2020 if chuser ("0:" ) == nil {
2121 t .Fatal ("the empty group is not allowed" )
2222 }
2323}
2424
2525// Either user only or user and group.
26- func TestGroupOnly (t * testing.T ) {
26+ func TestGroupOnly (t * testing.T ) {
2727 if chuser (":0" ) == nil {
2828 t .Fatal ("group only is not allowed" )
2929 }
3030}
3131
3232// Usenames must not contain the number sign.
33- func TestInvalidUsername (t * testing.T ) {
33+ func TestInvalidUsername (t * testing.T ) {
3434 const username = "#user"
3535 if chuser (username ) == nil {
3636 t .Fatalf ("'%s' is not a valid username" , username )
3737 }
3838}
3939
4040// User IDs must be non-negative.
41- func TestInvalidUserid (t * testing.T ) {
41+ func TestInvalidUserid (t * testing.T ) {
4242 if chuser ("-1" ) == nil {
4343 t .Fatal ("User ID cannot be negative" )
4444 }
4545}
4646
4747// Change to the current user by ID.
48- func TestCurrentUserid (t * testing.T ) {
48+ func TestCurrentUserid (t * testing.T ) {
4949 usr , err := user .Current ()
5050 if err != nil {
5151 t .Fatal (err )
@@ -61,7 +61,7 @@ func TestCurrentUserid (t *testing.T) {
6161}
6262
6363// Change to a common user by name.
64- func TestCommonUsername (t * testing.T ) {
64+ func TestCommonUsername (t * testing.T ) {
6565 usr , err := user .Current ()
6666 if err != nil {
6767 t .Fatal (err )
0 commit comments