TBR gosh: Minor move of some test-code between files, and fix import.
Change-Id: If138834ca8b8bb30aab74d86f8f291a8a1f2de6f
diff --git a/gosh/pipeline_test.go b/gosh/pipeline_test.go
index d26d5b9..25901e2 100644
--- a/gosh/pipeline_test.go
+++ b/gosh/pipeline_test.go
@@ -70,17 +70,6 @@
setsErr(t, sh1, func() { p.PipeCombinedOutput(sh2.FuncCmd(catFunc)) })
}
-var writeLoopFunc = gosh.RegisterFunc("writeLoopFunc", func() error {
- for {
- if _, err := os.Stdout.Write([]byte("a\n")); err != nil {
- // Always return success; the purpose of this command is to ensure that
- // when the next command in the pipeline fails, it causes a closed pipe
- // write error here to exit the loop.
- return nil
- }
- }
-})
-
func TestPipelineClosedPipe(t *testing.T) {
sh := gosh.NewShell(gosh.Opts{Fatalf: makeFatalf(t), Logf: t.Logf})
defer sh.Cleanup()
diff --git a/gosh/shell_test.go b/gosh/shell_test.go
index 0a7a6b6..29d4f09 100644
--- a/gosh/shell_test.go
+++ b/gosh/shell_test.go
@@ -28,7 +28,7 @@
"time"
"v.io/x/lib/gosh"
- lib "v.io/x/lib/gosh/internal/gosh_example_lib"
+ "v.io/x/lib/gosh/internal/gosh_example_lib"
)
var fakeError = errors.New("fake error")
@@ -715,6 +715,17 @@
nok(t, c.Err)
}
+var writeLoopFunc = gosh.RegisterFunc("writeLoopFunc", func() error {
+ for {
+ if _, err := os.Stdout.Write([]byte("a\n")); err != nil {
+ // Always return success; the purpose of this command is to ensure that
+ // when the next command in the pipeline fails, it causes a closed pipe
+ // write error here to exit the loop.
+ return nil
+ }
+ }
+})
+
type errorWriter struct {
error
}