aboutsummaryrefslogtreecommitdiff
path: root/export_test.go
diff options
context:
space:
mode:
authorAlex Ogier <[email protected]>2012-04-26 17:52:05 -0400
committerAlex Ogier <[email protected]>2012-04-26 17:52:05 -0400
commit6bdb0b3748b247a8c28532fcd78b60c1a7ec07db (patch)
treee18122507120a82cc073f481ad1bf3f7f6c152cc /export_test.go
Copy the flag module from the go standard library
Diffstat (limited to 'export_test.go')
-rw-r--r--export_test.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/export_test.go b/export_test.go
new file mode 100644
index 0000000..7b19080
--- /dev/null
+++ b/export_test.go
@@ -0,0 +1,22 @@
+// Copyright 2010 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package flag
+
+import "os"
+
+// Additional routines compiled into the package only during testing.
+
+// ResetForTesting clears all flag state and sets the usage function as directed.
+// After calling ResetForTesting, parse errors in flag handling will not
+// exit the program.
+func ResetForTesting(usage func()) {
+ commandLine = NewFlagSet(os.Args[0], ContinueOnError)
+ Usage = usage
+}
+
+// CommandLine returns the default FlagSet.
+func CommandLine() *FlagSet {
+ return commandLine
+}