github.com/matthewdale/lab@v0.14.0/cmd/snippet_list_test.go (about)

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