summaryrefslogtreecommitdiff
path: root/libgo/go/os/user/lookup_unix_test.go
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2022-02-11 14:53:56 -0800
committerIan Lance Taylor <iant@golang.org>2022-02-11 15:01:19 -0800
commit8dc2499aa62f768c6395c9754b8cabc1ce25c494 (patch)
tree43d7fd2bbfd7ad8c9625a718a5e8718889351994 /libgo/go/os/user/lookup_unix_test.go
parent9a56779dbc4e2d9c15be8d31e36f2f59be7331a8 (diff)
downloadgcc-8dc2499aa62f768c6395c9754b8cabc1ce25c494.tar.gz
libgo: update to Go1.18beta2
gotools/ * Makefile.am (go_cmd_cgo_files): Add ast_go118.go (check-go-tool): Copy golang.org/x/tools directories. * Makefile.in: Regenerate. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/384695
Diffstat (limited to 'libgo/go/os/user/lookup_unix_test.go')
-rw-r--r--libgo/go/os/user/lookup_unix_test.go32
1 files changed, 1 insertions, 31 deletions
diff --git a/libgo/go/os/user/lookup_unix_test.go b/libgo/go/os/user/lookup_unix_test.go
index 060cfe186f5..77917677fc1 100644
--- a/libgo/go/os/user/lookup_unix_test.go
+++ b/libgo/go/os/user/lookup_unix_test.go
@@ -3,36 +3,15 @@
// license that can be found in the LICENSE file.
//go:build (aix || darwin || dragonfly || freebsd || (!android && linux) || netbsd || openbsd || solaris) && !cgo
-// +build aix darwin dragonfly freebsd !android,linux netbsd openbsd solaris
-// +build !cgo
package user
import (
- "fmt"
"reflect"
"strings"
"testing"
)
-var testGroupFile = `# See the opendirectoryd(8) man page for additional
-# information about Open Directory.
-##
-nobody:*:-2:
-nogroup:*:-1:
-wheel:*:0:root
-emptyid:*::root
-invalidgid:*:notanumber:root
-+plussign:*:20:root
--minussign:*:21:root
-
-daemon:*:1:root
- indented:*:7:
-# comment:*:4:found
- # comment:*:4:found
-kmem:*:2:root
-` + largeGroup()
-
var groupTests = []struct {
in string
name string
@@ -51,19 +30,10 @@ var groupTests = []struct {
{testGroupFile, "indented", "7"},
{testGroupFile, "# comment", ""},
{testGroupFile, "largegroup", "1000"},
+ {testGroupFile, "manymembers", "777"},
{"", "emptyfile", ""},
}
-// Generate a proper "largegroup" entry for testGroupFile string
-func largeGroup() (res string) {
- var b strings.Builder
- b.WriteString("largegroup:x:1000:user1")
- for i := 2; i <= 7500; i++ {
- fmt.Fprintf(&b, ",user%d", i)
- }
- return b.String()
-}
-
func TestFindGroupName(t *testing.T) {
for _, tt := range groupTests {
got, err := findGroupName(tt.name, strings.NewReader(tt.in))