瀏覽代碼

Merge pull request #3740 from tianon/fix-mflag-dyntest

Fix mflag test issue with "ResetForTesting"
Victor Vieux 11 年之前
父節點
當前提交
4e08bb5629
共有 2 個文件被更改,包括 7 次插入17 次删除
  1. 0 17
      pkg/mflag/export_test.go
  2. 7 0
      pkg/mflag/flag_test.go

+ 0 - 17
pkg/mflag/export_test.go

@@ -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
-}

+ 7 - 0
pkg/mflag/flag_test.go

@@ -15,6 +15,13 @@ import (
 	"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 {
 	if s == "0" {
 		return "false"