export_test.go 607 B

1234567891011121314151617181920
  1. // Copyright 2010 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 flag
  5. import "os"
  6. // Additional routines compiled into the package only during testing.
  7. var DefaultUsage = Usage
  8. // ResetForTesting clears all flag state and sets the usage function as directed.
  9. // After calling ResetForTesting, parse errors in flag handling will not
  10. // exit the program.
  11. func ResetForTesting(usage func()) {
  12. CommandLine = NewFlagSet(os.Args[0], ContinueOnError)
  13. CommandLine.Usage = commandLineUsage
  14. Usage = usage
  15. }