Fix mflag test issue with "ResetForTesting" (which only showed up under dyntest for some odd reason)
Docker-DCO-1.1-Signed-off-by: Andrew Page <admwiggin@gmail.com> (github: tianon)
This commit is contained in:
parent
69fbcf8d08
commit
291f245f79
2 changed files with 7 additions and 17 deletions
|
@ -1,17 +0,0 @@
|
||||||
// Copyright 2014 The Docker & 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 mflag
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
|
@ -15,6 +15,13 @@ import (
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// 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
|
||||||
|
}
|
||||||
func boolString(s string) string {
|
func boolString(s string) string {
|
||||||
if s == "0" {
|
if s == "0" {
|
||||||
return "false"
|
return "false"
|
||||||
|
|
Loading…
Reference in a new issue