package io_test

import (
	"os"
	"strings"

	. "github.com/cloudfoundry/cli/testhelpers/io"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("io helpers", func() {
	It("will never overflow the pipe", func() {
		characters := make([]string, 0, 75000)
		for i := 0; i < 75000; i++ {
			characters = append(characters, "z")
		}

		str := strings.Join(characters, "")

		output := CaptureOutput(func() {
			os.Stdout.Write([]byte(str))
		})

		Expect(output).To(Equal([]string{str}))
	})
})

package io_test

import (
	"os"

	. "github.com/cloudfoundry/cli/testhelpers/io"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("io helpers", func() {
	It("will never overflow the pipe", func() {
		str := ""
		for i := 0; i < 75000; i++ {
			str += "abc"
		}

		output := CaptureOutput(func() {
			os.Stdout.Write([]byte(str))
		})

		Expect(output).To(Equal([]string{str}))
	})
})

--- 
+++ 
@@ -2,6 +2,7 @@
 
 import (
 	"os"
+	"strings"
 
 	. "github.com/cloudfoundry/cli/testhelpers/io"
 	. "github.com/onsi/ginkgo"
@@ -10,10 +11,12 @@
 
 var _ = Describe("io helpers", func() {
 	It("will never overflow the pipe", func() {
-		str := ""
+		characters := make([]string, 0, 75000)
 		for i := 0; i < 75000; i++ {
-			str += "abc"
+			characters = append(characters, "z")
 		}
+
+		str := strings.Join(characters, "")
 
 		output := CaptureOutput(func() {
 			os.Stdout.Write([]byte(str))
Speed up this test by a factor of a lot
