github.com/khulnasoft-lab/defsec@v1.0.5-0.20230827010352-5e9f46893d95/pkg/scanners/azure/functions/copy_index_test.go (about)

     1  package functions
     2  
     3  import "testing"
     4  
     5  func Test_CopyIndex(t *testing.T) {
     6  	tests := []struct {
     7  		name     string
     8  		args     []interface{}
     9  		expected int
    10  	}{
    11  		{
    12  			name:     "CopyIndex with 1",
    13  			args:     []interface{}{},
    14  			expected: 1,
    15  		},
    16  		{
    17  			name:     "CopyIndex with 2",
    18  			args:     []interface{}{},
    19  			expected: 2,
    20  		},
    21  		{
    22  			name:     "CopyIndex with 3",
    23  			args:     []interface{}{},
    24  			expected: 3,
    25  		},
    26  		{
    27  			name:     "CopyIndex with loopName",
    28  			args:     []interface{}{"loop1"},
    29  			expected: 1,
    30  		},
    31  		{
    32  			name: "CopyIndex with same lo" +
    33  				"opName",
    34  			args:     []interface{}{"loop1"},
    35  			expected: 2,
    36  		},
    37  		{
    38  			name:     "CopyIndex with loopName",
    39  			args:     []interface{}{"loop2", 10},
    40  			expected: 10,
    41  		},
    42  	}
    43  
    44  	for _, tt := range tests {
    45  		t.Run(tt.name, func(t *testing.T) {
    46  			got := CopyIndex(tt.args...)
    47  			if got != tt.expected {
    48  				t.Errorf("CopyIndex() = %v, want %v", got, tt.expected)
    49  			}
    50  		})
    51  	}
    52  }