/usr/share/gocode/src/github.com/hashicorp/uuid/uuid_test.go is in golang-github-hashicorp-uuid-dev 0.0~git20160311.0.ebb0a03-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | package uuid
import (
"regexp"
"testing"
)
func TestGenerateUUID(t *testing.T) {
prev := GenerateUUID()
for i := 0; i < 100; i++ {
id := GenerateUUID()
if prev == id {
t.Fatalf("Should get a new ID!")
}
matched, err := regexp.MatchString(
"[\\da-f]{8}-[\\da-f]{4}-[\\da-f]{4}-[\\da-f]{4}-[\\da-f]{12}", id)
if !matched || err != nil {
t.Fatalf("expected match %s %v %s", id, matched, err)
}
}
}
func BenchmarkGenerateUUID(b *testing.B) {
for n := 0; n < b.N; n++ {
_ = GenerateUUID()
}
}
|