ignore name tag when checking if way of multipolygon was inserted
parent
204332bef4
commit
8a3585dbba
|
@ -36,11 +36,17 @@ func tagsSameOrEmpty(a, b element.Tags) bool {
|
|||
return true
|
||||
}
|
||||
for k, v := range a {
|
||||
if k == "name" {
|
||||
continue
|
||||
}
|
||||
if cmp, ok := b[k]; !ok || v != cmp {
|
||||
return false
|
||||
}
|
||||
}
|
||||
for k, v := range b {
|
||||
if k == "name" {
|
||||
continue
|
||||
}
|
||||
if cmp, ok := a[k]; !ok || v != cmp {
|
||||
return false
|
||||
}
|
||||
|
|
|
@ -182,3 +182,42 @@ func TestRingMergePermutations(t *testing.T) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestTagsSameOrEmpty(t *testing.T) {
|
||||
var a, b element.Tags
|
||||
|
||||
a = element.Tags{"natural": "water"}
|
||||
b = element.Tags{"natural": "water"}
|
||||
if tagsSameOrEmpty(a, b) != true {
|
||||
t.Fatal(a, b)
|
||||
}
|
||||
|
||||
a = element.Tags{"natural": "water"}
|
||||
b = element.Tags{"natural": "water", "name": "bar"}
|
||||
if tagsSameOrEmpty(a, b) != true {
|
||||
t.Fatal(a, b)
|
||||
}
|
||||
if tagsSameOrEmpty(b, a) != true {
|
||||
t.Fatal(a, b)
|
||||
}
|
||||
|
||||
a = element.Tags{"natural": "water"}
|
||||
b = element.Tags{}
|
||||
if tagsSameOrEmpty(a, b) != true {
|
||||
t.Fatal(a, b)
|
||||
}
|
||||
|
||||
if tagsSameOrEmpty(b, a) != false {
|
||||
t.Fatal(a, b)
|
||||
}
|
||||
|
||||
a = element.Tags{"natural": "water"}
|
||||
b = element.Tags{"landusage": "forest", "natural": "water"}
|
||||
if tagsSameOrEmpty(a, b) != false {
|
||||
t.Fatal(a, b)
|
||||
}
|
||||
if tagsSameOrEmpty(b, a) != false {
|
||||
t.Fatal(a, b)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue