A 0.6.1-rc.2 server sends ptr_other_views without ptr_other_views_list, so zone show printed only "and 1 more" under "Other views:". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
26 lines
627 B
Go
26 lines
627 B
Go
package main
|
|
|
|
import (
|
|
"bytes"
|
|
"strings"
|
|
"testing"
|
|
|
|
"jarl/internal/api"
|
|
)
|
|
|
|
func TestPrintPTRFills(t *testing.T) {
|
|
var b bytes.Buffer
|
|
printPTRFills(&b, []api.PTRFill{{Address: "10.0.10.20", Target: "nextcloud.adbraun.lol.", From: "internal"}}, 3)
|
|
out := b.String()
|
|
if !strings.Contains(out, "10.0.10.20 -> nextcloud.adbraun.lol (view internal)") || !strings.Contains(out, "and 2 more") {
|
|
t.Errorf("listed fills:\n%s", out)
|
|
}
|
|
|
|
// An older server sends the count without the list.
|
|
b.Reset()
|
|
printPTRFills(&b, nil, 1)
|
|
if b.Len() != 0 {
|
|
t.Errorf("no list from the server printed %q, want nothing", b.String())
|
|
}
|
|
}
|