github.com/posener/gitfs@v1.2.2-0.20200410105819-ea4e48d73ab9/fsutil/walk_test.go (about)

     1  package fsutil
     2  
     3  import (
     4  	"net/http"
     5  	"testing"
     6  
     7  	"github.com/stretchr/testify/assert"
     8  )
     9  
    10  func TestWalk(t *testing.T) {
    11  	t.Parallel()
    12  
    13  	var got []string
    14  	for walker := Walk(http.Dir("../internal"), "testdata"); walker.Step(); {
    15  		got = append(got, walker.Path())
    16  	}
    17  	want := []string{
    18  		"testdata",
    19  		"testdata/f01",
    20  		"testdata/d2",
    21  		"testdata/d2/f21",
    22  		"testdata/d1",
    23  		"testdata/d1/d11",
    24  		"testdata/d1/d11/f111",
    25  	}
    26  	assert.ElementsMatch(t, want, got)
    27  }