flag.go 607 B

12345678910111213141516171819202122
  1. // Copyright 2015 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. package testtext
  5. import (
  6. "flag"
  7. "testing"
  8. "golang.org/x/text/internal/gen"
  9. )
  10. var long = flag.Bool("long", false,
  11. "run tests that require fetching data online")
  12. // SkipIfNotLong returns whether long tests should be performed.
  13. func SkipIfNotLong(t *testing.T) {
  14. if testing.Short() || !(gen.IsLocal() || *long) {
  15. t.Skip("skipping test to prevent downloading; to run use -long or use -local or UNICODE_DIR to specify a local source")
  16. }
  17. }