github.com/zaquestion/lab@v0.25.1/cmd/snippet_list_test.go (about)

     1  package cmd
     2  
     3  import (
     4  	"os/exec"
     5  	"testing"
     6  
     7  	"github.com/stretchr/testify/require"
     8  )
     9  
    10  // Test for listing personal snippets in snippet_test.go
    11  
    12  func Test_snippetList(t *testing.T) {
    13  	t.Parallel()
    14  	repo := copyTestRepo(t)
    15  	cmd := exec.Command(labBinaryPath, "snippet", "list", "-n", "1", "lab-testing")
    16  	cmd.Dir = repo
    17  
    18  	b, err := cmd.CombinedOutput()
    19  	if err != nil {
    20  		t.Log(string(b))
    21  		t.Fatal(err)
    22  	}
    23  	require.Regexp(t, `#\d+ snippet title`, string(b))
    24  }