github.com/cockroachdb/pebble@v1.1.2/internal/mkbench/util_test.go (about)

     1  // Copyright 2021 The LevelDB-Go and Pebble Authors. All rights reserved. Use
     2  // of this source code is governed by a BSD-style license that can be found in
     3  // the LICENSE file.
     4  
     5  package main
     6  
     7  import (
     8  	"os"
     9  	"testing"
    10  
    11  	"github.com/stretchr/testify/require"
    12  )
    13  
    14  func TestWalkDir(t *testing.T) {
    15  	maybeSkip(t)
    16  
    17  	// Number of files and directories in the data fixture directory (and
    18  	// therefore the symlinked directory). Generated via:
    19  	//   find . testdata | wc -l
    20  	const wantCount = 97
    21  	for _, path := range dataDirPaths {
    22  		t.Run(path, func(t *testing.T) {
    23  			var paths []string
    24  			err := walkDir(path, func(_, pathRel string, info os.FileInfo) error {
    25  				paths = append(paths, pathRel)
    26  				return nil
    27  			})
    28  			require.NoError(t, err)
    29  			require.Equal(t, wantCount, len(paths))
    30  		})
    31  	}
    32  }