github.com/tilt-dev/tilt@v0.33.15-0.20240515162809-0a22ed45d8a0/internal/ospath/display_test.go (about)

     1  package ospath
     2  
     3  import (
     4  	"os"
     5  	"path/filepath"
     6  	"testing"
     7  
     8  	"github.com/stretchr/testify/require"
     9  )
    10  
    11  func TestFormatChangedFileListTruncates(t *testing.T) {
    12  	actual := FormatFileChangeList([]string{"a", "b", "c", "d", "e", "f"})
    13  	expected := "[a b c d e ...]"
    14  	require.Equal(t, expected, actual)
    15  }
    16  
    17  func TestFormatChangedFileListMakesRelative(t *testing.T) {
    18  	wd, err := os.Getwd()
    19  	require.NoError(t, err)
    20  	actual := FormatFileChangeList([]string{filepath.Join(wd, "foo"), "/bar/baz"})
    21  	expected := "[foo /bar/baz]"
    22  	require.Equal(t, expected, actual)
    23  }