@@ -4317,3 +4317,57 @@ func isSharedProviderSupported() bool {
43174317 return false
43184318 }
43194319}
4320+
4321+ func TestSlicesEqual (t * testing.T ) {
4322+ tests := []struct {
4323+ name string
4324+ s1 []string
4325+ s2 []string
4326+ want bool
4327+ }{
4328+ {
4329+ name : "same order" ,
4330+ s1 : []string {"read" , "write" },
4331+ s2 : []string {"read" , "write" },
4332+ want : true ,
4333+ },
4334+ {
4335+ name : "different order" ,
4336+ s1 : []string {"read" , "write" },
4337+ s2 : []string {"write" , "read" },
4338+ want : true ,
4339+ },
4340+ {
4341+ name : "different lengths" ,
4342+ s1 : []string {"read" },
4343+ s2 : []string {"read" , "write" },
4344+ want : false ,
4345+ },
4346+ {
4347+ name : "same length different values" ,
4348+ s1 : []string {"read" , "write" },
4349+ s2 : []string {"read" , "delete" },
4350+ want : false ,
4351+ },
4352+ {
4353+ name : "same length different multiplicity" ,
4354+ s1 : []string {"read" , "write" },
4355+ s2 : []string {"read" , "read" },
4356+ want : false ,
4357+ },
4358+ {
4359+ name : "same multiplicity" ,
4360+ s1 : []string {"read" , "read" , "write" },
4361+ s2 : []string {"write" , "read" , "read" },
4362+ want : true ,
4363+ },
4364+ }
4365+
4366+ for _ , tt := range tests {
4367+ t .Run (tt .name , func (t * testing.T ) {
4368+ if got := util .SlicesEqual (tt .s1 , tt .s2 ); got != tt .want {
4369+ t .Fatalf ("SlicesEqual(%v, %v) = %v, want %v" , tt .s1 , tt .s2 , got , tt .want )
4370+ }
4371+ })
4372+ }
4373+ }
0 commit comments