4c4a65ebd0
This introduces a function that compares two string policy sets while ignoring the presence of "default" (since it's added by core, not the backend), and ensuring that ordering and/or duplication are not failure conditions. Fixes #1256
27 lines
424 B
Go
27 lines
424 B
Go
package policies
|
|
|
|
import "testing"
|
|
|
|
func TestEquivalentPolicies(t *testing.T) {
|
|
a := []string{"foo", "bar"}
|
|
var b []string
|
|
if EquivalentPolicies(a, b) {
|
|
t.Fatal("bad")
|
|
}
|
|
|
|
b = []string{"foo"}
|
|
if EquivalentPolicies(a, b) {
|
|
t.Fatal("bad")
|
|
}
|
|
|
|
b = []string{"bar", "foo"}
|
|
if !EquivalentPolicies(a, b) {
|
|
t.Fatal("bad")
|
|
}
|
|
|
|
b = []string{"foo", "default", "bar"}
|
|
if !EquivalentPolicies(a, b) {
|
|
t.Fatal("bad")
|
|
}
|
|
}
|