8 "github.com/stretchr/testify/require"
11func TestHasRootMarkers(t *testing.T) {
14 // Create a temporary directory for testing
17 // Test with empty root markers (should return true)
18 require.True(t, HasRootMarkers(tmpDir, []string{}))
20 // Test with non-existent markers
21 require.False(t, HasRootMarkers(tmpDir, []string{"go.mod", "package.json"}))
23 // Create a go.mod file
24 goModPath := filepath.Join(tmpDir, "go.mod")
25 err := os.WriteFile(goModPath, []byte("module test"), 0o644)
26 require.NoError(t, err)
28 // Test with existing marker
29 require.True(t, HasRootMarkers(tmpDir, []string{"go.mod", "package.json"}))
31 // Test with only non-existent markers
32 require.False(t, HasRootMarkers(tmpDir, []string{"package.json", "Cargo.toml"}))
34 // Test with glob patterns
35 require.True(t, HasRootMarkers(tmpDir, []string{"*.mod"}))
36 require.False(t, HasRootMarkers(tmpDir, []string{"*.json"}))
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list