github.com/ppphp/yayagf@v0.0.1/internal/command/command_test.go (about)

     1  package command
     2  
     3  import (
     4  	"bytes"
     5  	"testing"
     6  
     7  	"github.com/stretchr/testify/require"
     8  )
     9  
    10  func TestDoCommand(t *testing.T) {
    11  	err, e, o := DoCommand("ls")
    12  	require.NoErrorf(t, err, "ls should be done, %v,%v, %v", e, o, err)
    13  
    14  	err, e, o = DoCommand("cnm")
    15  	require.Errorf(t, err, "cnm should not be done, %v,%v, %v", e, o, err)
    16  }
    17  
    18  func TestGoCommand(t *testing.T) {
    19  
    20  	out, errs := &bytes.Buffer{}, &bytes.Buffer{}
    21  	cmd := GoCommand("cnm", nil, out, errs)
    22  	require.NotNil(t, cmd, "cnm should not be done, %v,%v", out.String(), errs.String())
    23  }