github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/libs/cosmos-sdk/tests/io.go (about)

     1  package tests
     2  
     3  import (
     4  	"bytes"
     5  	"strings"
     6  
     7  	"github.com/spf13/cobra"
     8  )
     9  
    10  // ApplyMockIO replaces stdin/out/err with buffers that can be used during testing.
    11  func ApplyMockIO(c *cobra.Command) (*strings.Reader, *bytes.Buffer, *bytes.Buffer) {
    12  	mockIn := strings.NewReader("")
    13  	mockOut := bytes.NewBufferString("")
    14  	mockErr := bytes.NewBufferString("")
    15  	c.SetIn(mockIn)
    16  	c.SetOut(mockOut)
    17  	c.SetErr(mockErr)
    18  	return mockIn, mockOut, mockErr
    19  }
    20  
    21  // DONTCOVER