github.com/nya3jp/tast@v0.0.0-20230601000426-85c8e4d83a9b/src/go.chromium.org/tast/core/internal/testing/global.go (about) 1 // Copyright 2020 The ChromiumOS Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 package testing 6 7 import ( 8 "os" 9 "path/filepath" 10 ) 11 12 var globalRegistry *Registry // singleton, initialized on first use 13 14 // GlobalRegistry returns a global registry containing tests 15 // registered by calls to AddTest. 16 func GlobalRegistry() *Registry { 17 if globalRegistry == nil { 18 globalRegistry = NewRegistry(filepath.Base(os.Args[0])) 19 } 20 return globalRegistry 21 }