mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
parent
0c251be66b
commit
2fefc01606
2 changed files with 11 additions and 2 deletions
|
@ -119,11 +119,17 @@ func (n *Namespace) Eq(first interface{}, others ...interface{}) bool {
|
|||
normFirst := normalize(first)
|
||||
for _, other := range others {
|
||||
if e, ok := first.(compare.Eqer); ok {
|
||||
return e.Eq(other)
|
||||
if e.Eq(other) {
|
||||
return true
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
if e, ok := other.(compare.Eqer); ok {
|
||||
return e.Eq(first)
|
||||
if e.Eq(first) {
|
||||
return true
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
other = normalize(other)
|
||||
|
|
|
@ -275,6 +275,9 @@ func TestEqualExtend(t *testing.T) {
|
|||
{1, []interface{}{1, 2}, true},
|
||||
{1, []interface{}{2, 1}, true},
|
||||
{1, []interface{}{2, 3}, false},
|
||||
{tstEqerType1("a"), []interface{}{tstEqerType1("a"), tstEqerType1("b")}, true},
|
||||
{tstEqerType1("a"), []interface{}{tstEqerType1("b"), tstEqerType1("a")}, true},
|
||||
{tstEqerType1("a"), []interface{}{tstEqerType1("b"), tstEqerType1("c")}, false},
|
||||
} {
|
||||
|
||||
result := ns.Eq(test.first, test.others...)
|
||||
|
|
Loading…
Reference in a new issue