Files
EvoBGP/internal/birdfmt/community_bird_test.go
T

31 lines
724 B
Go

package birdfmt
import "testing"
func TestRouteCommunityAttrs_StandardName(t *testing.T) {
s, err := RouteCommunityAttrs("", "65000:120", "{}")
if err != nil {
t.Fatal(err)
}
if s != " bgp_community.add((65000,120));" {
t.Fatalf("got %q", s)
}
}
func TestRouteCommunityAttrs_LargeJSON(t *testing.T) {
s, err := RouteCommunityAttrs("large", "x", `{"large":[[65000,1,2]]}`)
if err != nil {
t.Fatal(err)
}
if s != " bgp_large_community.add((65000,1,2));" {
t.Fatalf("got %q", s)
}
}
func TestRouteCommunityAttrs_StandardArrayOneElement(t *testing.T) {
_, err := RouteCommunityAttrs("", "x", `{"standard":[65000]}`)
if err == nil {
t.Fatal("expected error for single-element standard pair")
}
}