445 lines
19 KiB
Go
445 lines
19 KiB
Go
package domain
|
|
|
|
import (
|
|
"bytes"
|
|
"errors"
|
|
"fmt"
|
|
"log/slog"
|
|
"strings"
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
var consentTestTime = time.Date(2026, 10, 6, 9, 30, 0, 0, time.UTC)
|
|
|
|
const consentTestVersion ConsentTextVersion = "c1-2026-10-01"
|
|
|
|
func TestParseConsentPurposeAcceptsOnlyC1ToC5(t *testing.T) {
|
|
for _, value := range []string{"c1", "c2", "c3", "c4", "c5"} {
|
|
purpose, err := ParseConsentPurpose(value)
|
|
if err != nil {
|
|
t.Fatalf("ParseConsentPurpose(%q) error = %v", value, err)
|
|
}
|
|
if purpose.OrganizationScoped() != (value == "c4") {
|
|
t.Fatalf("%s.OrganizationScoped() = %v, want true only for c4", value, purpose.OrganizationScoped())
|
|
}
|
|
}
|
|
for _, value := range []string{"", "C1", "c0", "c6", "c1 "} {
|
|
if _, err := ParseConsentPurpose(value); !errors.Is(err, ErrInvalidConsent) {
|
|
t.Fatalf("ParseConsentPurpose(%q) error = %v, want ErrInvalidConsent", value, err)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestParseConsentTextVersionFollowsTheContractPattern(t *testing.T) {
|
|
for _, value := range []string{"c1-2026-10-01", "v1.2_rc", strings.Repeat("a", 64)} {
|
|
if _, err := ParseConsentTextVersion(value); err != nil {
|
|
t.Fatalf("ParseConsentTextVersion(%q) error = %v", value, err)
|
|
}
|
|
}
|
|
for _, value := range []string{"", " ", "c1 2026", "c1/2026", "версия", strings.Repeat("a", 65)} {
|
|
if _, err := ParseConsentTextVersion(value); !errors.Is(err, ErrInvalidConsentText) {
|
|
t.Fatalf("ParseConsentTextVersion(%q) error = %v, want ErrInvalidConsentText", value, err)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestConsentTextHashFromBytesRefusesEmptyAndMalformedDigests(t *testing.T) {
|
|
valid := HashConsentText("text")
|
|
if hash, err := ConsentTextHashFromBytes(valid[:]); err != nil || hash != valid {
|
|
t.Fatalf("ConsentTextHashFromBytes(valid) = %x, %v", hash, err)
|
|
}
|
|
for name, value := range map[string][]byte{
|
|
"nil": nil,
|
|
"empty": {},
|
|
"short": valid[:31],
|
|
"long": append(valid[:], 0),
|
|
"all zero": make([]byte, ConsentTextHashSize),
|
|
} {
|
|
if _, err := ConsentTextHashFromBytes(value); !errors.Is(err, ErrInvalidConsentText) {
|
|
t.Fatalf("ConsentTextHashFromBytes(%s) error = %v, want ErrInvalidConsentText", name, err)
|
|
}
|
|
}
|
|
}
|
|
|
|
func storedText(purpose, body string) StoredConsentText {
|
|
hash := HashConsentText(body)
|
|
return StoredConsentText{
|
|
Purpose: purpose,
|
|
Version: purpose + "-2026-10-01",
|
|
Body: body,
|
|
Hash: hash[:],
|
|
Kind: string(ConsentTextKindDemo),
|
|
PublishedAt: consentTestTime,
|
|
}
|
|
}
|
|
|
|
func TestRestoreConsentTextChecksTheHashAndThePlaceholder(t *testing.T) {
|
|
text, err := RestoreConsentText(storedText("c1", "I consent."))
|
|
if err != nil {
|
|
t.Fatalf("RestoreConsentText(c1) error = %v", err)
|
|
}
|
|
if text.Hash() != HashConsentText("I consent.") || text.Purpose() != ConsentPurposePersonalData {
|
|
t.Fatalf("restored text = %s %x, want the stored purpose and hash", text.Purpose(), text.Hash())
|
|
}
|
|
|
|
tampered := storedText("c1", "I consent.")
|
|
tampered.Body = "I consent to more."
|
|
changedKind := storedText("c1", "I consent.")
|
|
changedKind.Kind = "draft"
|
|
for name, stored := range map[string]StoredConsentText{
|
|
"body changed after hashing": tampered,
|
|
"C4 without the placeholder": storedText("c4", "I consent to the transfer."),
|
|
"C2 with the placeholder": storedText("c2", "I consent for {organization}."),
|
|
"unknown kind": changedKind,
|
|
"empty body": storedText("c3", ""),
|
|
} {
|
|
if _, err := RestoreConsentText(stored); !errors.Is(err, ErrInvalidConsentText) {
|
|
t.Fatalf("RestoreConsentText(%s) error = %v, want ErrInvalidConsentText", name, err)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestRenderForOrganizationNamesTheOrganizationOnlyInC4(t *testing.T) {
|
|
contact, err := RestoreConsentText(storedText("c4", "I consent to the transfer to {organization}."))
|
|
if err != nil {
|
|
t.Fatalf("RestoreConsentText(c4) error = %v", err)
|
|
}
|
|
shown, err := contact.RenderForOrganization("ООО Пример")
|
|
if err != nil {
|
|
t.Fatalf("RenderForOrganization() error = %v", err)
|
|
}
|
|
if shown != "I consent to the transfer to ООО Пример." {
|
|
t.Fatalf("RenderForOrganization() = %q", shown)
|
|
}
|
|
// The ledger stores the hash of the shown text, which differs per
|
|
// organization and from the hash of the published template.
|
|
other, err := contact.RenderForOrganization("Other LLC")
|
|
if err != nil {
|
|
t.Fatalf("RenderForOrganization(other) error = %v", err)
|
|
}
|
|
if HashConsentText(shown) == contact.Hash() || HashConsentText(shown) == HashConsentText(other) {
|
|
t.Fatal("the shown C4 text must hash differently per organization and from the template")
|
|
}
|
|
for _, name := range []string{"", " Leading", "Trailing ", "Two\nlines", strings.Repeat("я", 201)} {
|
|
if _, err := contact.RenderForOrganization(name); !errors.Is(err, ErrInvalidConsentText) {
|
|
t.Fatalf("RenderForOrganization(%q) error = %v, want ErrInvalidConsentText", name, err)
|
|
}
|
|
}
|
|
personalData, err := RestoreConsentText(storedText("c1", "I consent."))
|
|
if err != nil {
|
|
t.Fatalf("RestoreConsentText(c1) error = %v", err)
|
|
}
|
|
if _, err := personalData.RenderForOrganization("Acme"); !errors.Is(err, ErrInvalidConsentText) {
|
|
t.Fatalf("RenderForOrganization(C1) error = %v, want ErrInvalidConsentText", err)
|
|
}
|
|
}
|
|
|
|
func TestNewContactFieldSetIsCanonicalAndRefusesDuplicates(t *testing.T) {
|
|
set, err := NewContactFieldSet(ContactFieldTelegram, ContactFieldEmail, ContactFieldFullName)
|
|
if err != nil {
|
|
t.Fatalf("NewContactFieldSet() error = %v", err)
|
|
}
|
|
reordered, err := NewContactFieldSet(ContactFieldFullName, ContactFieldTelegram, ContactFieldEmail)
|
|
if err != nil {
|
|
t.Fatalf("NewContactFieldSet(reordered) error = %v", err)
|
|
}
|
|
if !set.Equal(reordered) || fmt.Sprint(set.Fields()) != "[email full_name telegram]" {
|
|
t.Fatalf("Fields() = %v, want the canonical order for any input order", set.Fields())
|
|
}
|
|
if set.Contains(ContactFieldPhone) {
|
|
t.Fatal("one field must never imply another")
|
|
}
|
|
fields := set.Fields()
|
|
fields[0] = ContactFieldPhone
|
|
if set.Contains(ContactFieldPhone) {
|
|
t.Fatal("Fields() must return a copy")
|
|
}
|
|
for name, input := range map[string][]ContactField{
|
|
"empty": nil,
|
|
"duplicate": {ContactFieldEmail, ContactFieldEmail},
|
|
"unknown": {ContactFieldEmail, "address"},
|
|
"too many": {ContactFieldEmail, ContactFieldPhone, ContactFieldTelegram, ContactFieldFullName, ContactFieldEmail},
|
|
} {
|
|
if _, err := NewContactFieldSet(input...); !errors.Is(err, ErrInvalidConsent) {
|
|
t.Fatalf("NewContactFieldSet(%s) error = %v, want ErrInvalidConsent", name, err)
|
|
}
|
|
}
|
|
}
|
|
|
|
func validGrantInput() ConsentGrantInput {
|
|
return ConsentGrantInput{
|
|
SubjectID: uuid.Must(uuid.NewV7()),
|
|
Purpose: ConsentPurposePersonalData,
|
|
TextVersion: consentTestVersion,
|
|
TextHash: HashConsentText("I consent."),
|
|
Source: ConsentSourceRegistration,
|
|
RegistrationVersion: 1,
|
|
GrantedAt: consentTestTime,
|
|
}
|
|
}
|
|
|
|
func TestNewConsentGrantValidatesEveryField(t *testing.T) {
|
|
grant, err := NewConsentGrant(validGrantInput())
|
|
if err != nil {
|
|
t.Fatalf("NewConsentGrant() error = %v", err)
|
|
}
|
|
if grant.ID().Version() != 7 || grant.Purpose() != ConsentPurposePersonalData || grant.RegistrationVersion() != 1 || grant.IsZero() {
|
|
t.Fatalf("grant = %s %s, want a UUIDv7 C1 grant", grant.ID(), grant.Purpose())
|
|
}
|
|
for name, change := range map[string]func(*ConsentGrantInput){
|
|
"C4 without its scope": func(input *ConsentGrantInput) {
|
|
input.Purpose, input.Source = ConsentPurposeContactDisclosure, ConsentSourceInvitationAcceptance
|
|
},
|
|
"unknown purpose": func(input *ConsentGrantInput) { input.Purpose = "c9" },
|
|
"empty text version": func(input *ConsentGrantInput) { input.TextVersion = "" },
|
|
"malformed text version": func(input *ConsentGrantInput) { input.TextVersion = "c1 v2" },
|
|
"missing text hash": func(input *ConsentGrantInput) { input.TextHash = ConsentTextHash{} },
|
|
"missing subject": func(input *ConsentGrantInput) { input.SubjectID = uuid.Nil },
|
|
"missing registration version": func(input *ConsentGrantInput) {
|
|
input.RegistrationVersion = 0
|
|
},
|
|
"settings grant with registration version": func(input *ConsentGrantInput) {
|
|
input.Source = ConsentSourceConsentSettings
|
|
},
|
|
"registration of C2": func(input *ConsentGrantInput) { input.Purpose = ConsentPurposePublication },
|
|
"invitation acceptance of C3": func(input *ConsentGrantInput) {
|
|
input.Purpose, input.Source = ConsentPurposeAutoCategorization, ConsentSourceInvitationAcceptance
|
|
},
|
|
"unknown source": func(input *ConsentGrantInput) { input.Source = "import" },
|
|
"missing grant time": func(input *ConsentGrantInput) { input.GrantedAt = time.Time{} },
|
|
} {
|
|
input := validGrantInput()
|
|
change(&input)
|
|
_, err := NewConsentGrant(input)
|
|
if !errors.Is(err, ErrInvalidConsent) && !errors.Is(err, ErrInvalidConsentText) {
|
|
t.Fatalf("NewConsentGrant(%s) error = %v, want a validation error", name, err)
|
|
}
|
|
}
|
|
}
|
|
|
|
const consentTestC4Body = "I consent to the transfer to {organization}."
|
|
|
|
func contactText(t *testing.T) ConsentText {
|
|
t.Helper()
|
|
text, err := RestoreConsentText(storedText("c4", consentTestC4Body))
|
|
if err != nil {
|
|
t.Fatalf("RestoreConsentText(c4) error = %v", err)
|
|
}
|
|
return text
|
|
}
|
|
|
|
func validContactGrantInput(t *testing.T) ContactConsentGrantInput {
|
|
t.Helper()
|
|
fields, err := NewContactFieldSet(ContactFieldEmail)
|
|
if err != nil {
|
|
t.Fatalf("NewContactFieldSet() error = %v", err)
|
|
}
|
|
return ContactConsentGrantInput{
|
|
SubjectID: uuid.Must(uuid.NewV7()),
|
|
OrganizationID: uuid.Must(uuid.NewV7()),
|
|
OrganizationName: "Acme",
|
|
Fields: fields,
|
|
InvitationID: uuid.Must(uuid.NewV7()),
|
|
InvitationTermsVersion: 2,
|
|
Text: contactText(t),
|
|
GrantedAt: consentTestTime,
|
|
}
|
|
}
|
|
|
|
func TestNewContactConsentGrantRequiresItsScope(t *testing.T) {
|
|
grant, err := NewContactConsentGrant(validContactGrantInput(t))
|
|
if err != nil {
|
|
t.Fatalf("NewContactConsentGrant() error = %v", err)
|
|
}
|
|
if grant.IsZero() || !grant.Fields().Contains(ContactFieldEmail) || grant.InvitationTermsVersion() != 2 ||
|
|
grant.OrganizationName() != "Acme" || grant.TextVersion() != "c4-2026-10-01" {
|
|
t.Fatalf("grant = %s, want the given scope", grant.ID())
|
|
}
|
|
// The grant hashes the text as shown for the organization; a caller
|
|
// never supplies hash bytes.
|
|
if grant.TextHash() != HashConsentText("I consent to the transfer to Acme.") {
|
|
t.Fatalf("TextHash() = %x, want the hash of the shown text", grant.TextHash())
|
|
}
|
|
personalData, err := RestoreConsentText(storedText("c1", "I consent."))
|
|
if err != nil {
|
|
t.Fatalf("RestoreConsentText(c1) error = %v", err)
|
|
}
|
|
for name, change := range map[string]func(*ContactConsentGrantInput){
|
|
"missing organization": func(input *ContactConsentGrantInput) { input.OrganizationID = uuid.Nil },
|
|
"missing organization name": func(input *ContactConsentGrantInput) { input.OrganizationName = "" },
|
|
"multi-line name": func(input *ContactConsentGrantInput) { input.OrganizationName = "Acme\nLLC" },
|
|
"missing field set": func(input *ContactConsentGrantInput) { input.Fields = ContactFieldSet{} },
|
|
"missing invitation": func(input *ContactConsentGrantInput) { input.InvitationID = uuid.Nil },
|
|
"non-positive terms version": func(input *ContactConsentGrantInput) { input.InvitationTermsVersion = 0 },
|
|
"missing subject": func(input *ContactConsentGrantInput) { input.SubjectID = uuid.Nil },
|
|
"missing text": func(input *ContactConsentGrantInput) { input.Text = ConsentText{} },
|
|
"text of another purpose": func(input *ContactConsentGrantInput) { input.Text = personalData },
|
|
"missing grant time": func(input *ContactConsentGrantInput) { input.GrantedAt = time.Time{} },
|
|
} {
|
|
input := validContactGrantInput(t)
|
|
change(&input)
|
|
_, err := NewContactConsentGrant(input)
|
|
if !errors.Is(err, ErrInvalidConsent) && !errors.Is(err, ErrInvalidConsentText) {
|
|
t.Fatalf("NewContactConsentGrant(%s) error = %v, want a validation error", name, err)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestGrantsAndRevocationsShowNoSubjectOrScope(t *testing.T) {
|
|
input := validContactGrantInput(t)
|
|
contact, err := NewContactConsentGrant(input)
|
|
if err != nil {
|
|
t.Fatalf("NewContactConsentGrant() error = %v", err)
|
|
}
|
|
personalInput := validGrantInput()
|
|
personal, err := NewConsentGrant(personalInput)
|
|
if err != nil {
|
|
t.Fatalf("NewConsentGrant() error = %v", err)
|
|
}
|
|
revocation, err := NewConsentRevocation(ConsentRevocationInput{
|
|
SubjectID: input.SubjectID, Purpose: ConsentPurposeContactDisclosure, OrganizationID: input.OrganizationID,
|
|
Source: ConsentRevocationSourceConsentSettings, RevokedAt: consentTestTime,
|
|
})
|
|
if err != nil {
|
|
t.Fatalf("NewConsentRevocation() error = %v", err)
|
|
}
|
|
var logs bytes.Buffer
|
|
logger := slog.New(slog.NewJSONHandler(&logs, nil))
|
|
logger.Info("consent", "contact", contact, "personal", personal, "revocation", revocation)
|
|
output := logs.String() + fmt.Sprintf("%v %+v %#v %+v %+v", contact, contact, personal, revocation, struct{ Grant ContactConsentGrant }{contact})
|
|
for _, private := range []string{
|
|
input.SubjectID.String(), input.OrganizationID.String(), input.InvitationID.String(),
|
|
personalInput.SubjectID.String(), "Acme", "email",
|
|
} {
|
|
if strings.Contains(output, private) {
|
|
t.Fatalf("output %q contains %q", output, private)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestNewConsentRevocationScopesOnlyC4ByOrganization(t *testing.T) {
|
|
subject, organization := uuid.Must(uuid.NewV7()), uuid.Must(uuid.NewV7())
|
|
valid := []ConsentRevocationInput{
|
|
{SubjectID: subject, Purpose: ConsentPurposePublication, Source: ConsentRevocationSourceConsentSettings, RevokedAt: consentTestTime},
|
|
{SubjectID: subject, Purpose: ConsentPurposeContactDisclosure, OrganizationID: organization, Source: ConsentRevocationSourceSupportRequest, RevokedAt: consentTestTime},
|
|
}
|
|
for _, input := range valid {
|
|
if _, err := NewConsentRevocation(input); err != nil {
|
|
t.Fatalf("NewConsentRevocation(%s) error = %v", input.Purpose, err)
|
|
}
|
|
}
|
|
for name, input := range map[string]ConsentRevocationInput{
|
|
"C4 without an organization": {SubjectID: subject, Purpose: ConsentPurposeContactDisclosure, Source: ConsentRevocationSourceConsentSettings, RevokedAt: consentTestTime},
|
|
"C1 with an organization": {SubjectID: subject, Purpose: ConsentPurposePersonalData, OrganizationID: organization, Source: ConsentRevocationSourceConsentSettings, RevokedAt: consentTestTime},
|
|
"unknown source": {SubjectID: subject, Purpose: ConsentPurposePersonalData, Source: "admin", RevokedAt: consentTestTime},
|
|
"missing subject": {Purpose: ConsentPurposePersonalData, Source: ConsentRevocationSourceConsentSettings, RevokedAt: consentTestTime},
|
|
"missing time": {SubjectID: subject, Purpose: ConsentPurposePersonalData, Source: ConsentRevocationSourceConsentSettings},
|
|
} {
|
|
if _, err := NewConsentRevocation(input); !errors.Is(err, ErrInvalidConsent) {
|
|
t.Fatalf("NewConsentRevocation(%s) error = %v, want ErrInvalidConsent", name, err)
|
|
}
|
|
}
|
|
}
|
|
|
|
func storedRecord(purpose string) StoredConsentRecord {
|
|
hash := HashConsentText("shown text")
|
|
record := StoredConsentRecord{
|
|
ID: uuid.Must(uuid.NewV7()),
|
|
SubjectID: uuid.Must(uuid.NewV7()),
|
|
Purpose: purpose,
|
|
TextVersion: purpose + "-2026-10-01",
|
|
TextHash: hash[:],
|
|
Source: string(ConsentSourceConsentSettings),
|
|
State: string(ConsentStateActive),
|
|
GrantedAt: consentTestTime,
|
|
}
|
|
if purpose == "c4" {
|
|
record.Source = string(ConsentSourceInvitationAcceptance)
|
|
record.OrganizationID = uuid.Must(uuid.NewV7())
|
|
record.OrganizationName = "Acme"
|
|
record.FieldSet = []string{"phone", "email"}
|
|
record.InvitationID = uuid.Must(uuid.NewV7())
|
|
record.InvitationTermsVersion = 1
|
|
}
|
|
return record
|
|
}
|
|
|
|
func TestRestoreConsentRecordMirrorsTheLedgerConstraints(t *testing.T) {
|
|
for _, purpose := range []string{"c1", "c2", "c3", "c4", "c5"} {
|
|
if _, err := RestoreConsentRecord(storedRecord(purpose)); err != nil {
|
|
t.Fatalf("RestoreConsentRecord(%s) error = %v", purpose, err)
|
|
}
|
|
}
|
|
revokedAt := consentTestTime.Add(time.Hour)
|
|
earlier := consentTestTime.Add(-time.Hour)
|
|
for name, change := range map[string]func(*StoredConsentRecord){
|
|
"C4 without an organization": func(record *StoredConsentRecord) { record.OrganizationID = uuid.Nil },
|
|
"C4 without its name snapshot": func(record *StoredConsentRecord) { record.OrganizationName = "" },
|
|
"C4 with an empty field set": func(record *StoredConsentRecord) { record.FieldSet = []string{} },
|
|
"C4 superseded": func(record *StoredConsentRecord) {
|
|
record.State = string(ConsentStateSuperseded)
|
|
},
|
|
"C4 from the settings": func(record *StoredConsentRecord) { record.Source = string(ConsentSourceConsentSettings) },
|
|
"revoked state without a stamp": func(record *StoredConsentRecord) {
|
|
record.State = string(ConsentStateRevoked)
|
|
},
|
|
"stamp without a source": func(record *StoredConsentRecord) {
|
|
record.RevokedAt, record.State = &revokedAt, string(ConsentStateRevoked)
|
|
},
|
|
"revocation before the grant": func(record *StoredConsentRecord) {
|
|
record.RevokedAt, record.RevocationSource, record.State = &earlier, string(ConsentRevocationSourceConsentSettings), string(ConsentStateRevoked)
|
|
},
|
|
"empty hash": func(record *StoredConsentRecord) { record.TextHash = nil },
|
|
"empty version": func(record *StoredConsentRecord) { record.TextVersion = "" },
|
|
"unknown state": func(record *StoredConsentRecord) { record.State = "pending" },
|
|
} {
|
|
record := storedRecord("c4")
|
|
change(&record)
|
|
_, err := RestoreConsentRecord(record)
|
|
if !errors.Is(err, ErrInvalidConsent) && !errors.Is(err, ErrInvalidConsentText) {
|
|
t.Fatalf("RestoreConsentRecord(%s) error = %v, want a validation error", name, err)
|
|
}
|
|
}
|
|
scoped := storedRecord("c3")
|
|
scoped.FieldSet = []string{"email"}
|
|
if _, err := RestoreConsentRecord(scoped); !errors.Is(err, ErrInvalidConsent) {
|
|
t.Fatalf("RestoreConsentRecord(C3 with fields) error = %v, want ErrInvalidConsent", err)
|
|
}
|
|
named := storedRecord("c1")
|
|
named.OrganizationName = "Acme"
|
|
if _, err := RestoreConsentRecord(named); !errors.Is(err, ErrInvalidConsent) {
|
|
t.Fatalf("RestoreConsentRecord(C1 with an organization name) error = %v, want ErrInvalidConsent", err)
|
|
}
|
|
}
|
|
|
|
func TestConsentRecordOutputShowsNoSubjectOrScope(t *testing.T) {
|
|
stored := storedRecord("c4")
|
|
record, err := RestoreConsentRecord(stored)
|
|
if err != nil {
|
|
t.Fatalf("RestoreConsentRecord() error = %v", err)
|
|
}
|
|
var logs bytes.Buffer
|
|
for _, logger := range []*slog.Logger{
|
|
slog.New(slog.NewTextHandler(&logs, nil)),
|
|
slog.New(slog.NewJSONHandler(&logs, nil)),
|
|
} {
|
|
logger.Info("consent", "record", record)
|
|
}
|
|
output := strings.Join([]string{
|
|
logs.String(),
|
|
fmt.Sprintf("%v %+v %#v %s", record, record, record, record),
|
|
fmt.Sprintf("%+v", struct{ Record ConsentRecord }{record}),
|
|
}, "\n")
|
|
for _, private := range []string{stored.SubjectID.String(), stored.OrganizationID.String(), stored.InvitationID.String(), "phone", "Acme"} {
|
|
if strings.Contains(output, private) {
|
|
t.Fatalf("output %q contains %q", output, private)
|
|
}
|
|
}
|
|
if !strings.Contains(output, record.ID().String()) || !strings.Contains(output, "c4") {
|
|
t.Fatalf("output %q, want the record ID and purpose", output)
|
|
}
|
|
}
|