@@ -40,8 +40,22 @@ func TestMenu(t *testing.T) {
4040 if len (menuOptions ) != 10 {
4141 t .Errorf ("Expected menuOptions length of 10, got %v" , len (menuOptions ))
4242 }
43+ })
44+
45+ t .Run ("TestMenuOptionsContent" , func (t * testing.T ) {
46+ menuOptions := Menu (
47+ []string {
48+ flagArray ,
49+ flagSliceLiteralComposta ,
50+ flagSliceForRange ,
51+ flagSliceFatiandoOuDeletando ,
52+ flagSliceAnexando ,
53+ flagSliceMake ,
54+ flagSliceMultiDimensional ,
55+ flagSliceSurpresaArraySubjacente ,
56+ flagMapsIntroducao ,
57+ })
4358
44- // Check if the menuOptions slice has the expected options.
4559 expectedOptions := []string {
4660 "--array" ,
4761 "--slice-literal-composta" ,
@@ -63,7 +77,6 @@ func TestMenu(t *testing.T) {
6377 })
6478
6579 t .Run ("TestMenuOptionsExecutionFunctions" , func (t * testing.T ) {
66- // Create a slice of MenuOptions.
6780 menuOptions := Menu (
6881 []string {
6982 flagArray ,
@@ -77,7 +90,6 @@ func TestMenu(t *testing.T) {
7790 flagMapsIntroducao ,
7891 })
7992
80- // Check if the menuOptions slice has the expected execution functions.
8193 for i , option := range menuOptions {
8294 if option .ExecFunc == nil {
8395 t .Errorf ("Expected option %v to have a non-nil execution function" , i )
@@ -99,13 +111,9 @@ func TestMenu(t *testing.T) {
99111 }
100112
101113 for i , execFunc := range newExecFunc {
102- // Test if the execution functions behave as expected.
103114 if menuOptions [i ].ExecFunc == nil || execFunc == nil {
104115 t .Errorf ("Execution function for option %v is nil" , i )
105116 } else {
106- // Example: Compare the behavior of the functions by invoking them.
107- // This assumes the functions have observable side effects or outputs.
108- // You may need to adapt this part based on your actual function behavior.
109117 menuOptions [i ].ExecFunc ()
110118 execFunc ()
111119 }
0 commit comments