github.com/databricks/cli@v0.203.0/main_test.go (about)

     1  package main
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/databricks/cli/cmd"
     7  	"github.com/spf13/cobra"
     8  	"github.com/stretchr/testify/assert"
     9  )
    10  
    11  func TestCommandsDontUseUnderscoreInName(t *testing.T) {
    12  	// We use underscore as separator between commands in logs
    13  	// so need to enforce that no command uses it in its name.
    14  	//
    15  	// This test lives in the main package because this is where
    16  	// all commands are imported.
    17  	//
    18  	queue := []*cobra.Command{cmd.New()}
    19  	for len(queue) > 0 {
    20  		cmd := queue[0]
    21  		assert.NotContains(t, cmd.Name(), "_")
    22  		queue = append(queue[1:], cmd.Commands()...)
    23  	}
    24  }