mirror of
https://github.com/turbot/steampipe.git
synced 2025-12-19 18:12:43 -05:00
* Add test for #4707: hideRootFlags should handle non-existent flags * Fix #4707: Add nil check in hideRootFlags
20 lines
571 B
Go
20 lines
571 B
Go
package cmd
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
// TestHideRootFlags_NonExistentFlag tests that hideRootFlags handles non-existent flags gracefully
|
|
// Bug #4707: hideRootFlags panics when called with a flag that doesn't exist
|
|
func TestHideRootFlags_NonExistentFlag(t *testing.T) {
|
|
// Initialize the root command
|
|
InitCmd()
|
|
|
|
// Test that calling hideRootFlags with a non-existent flag should NOT panic
|
|
assert.NotPanics(t, func() {
|
|
hideRootFlags("non-existent-flag")
|
|
}, "hideRootFlags should handle non-existent flags without panicking")
|
|
}
|