Download this file
| 1 | package mapa |
| 2 | |
| 3 | import "testing" |
| 4 | |
| 5 | func TestS3OmitsAbsentPartsAndTheirSeparator(t *testing.T) { |
| 6 | for _, check := range []struct { |
| 7 | kind string |
| 8 | record Record |
| 9 | want string |
| 10 | }{ |
| 11 | {KindPage, Record{Title: "Acme", Body: "Text."}, "Acme\n\nText."}, |
| 12 | {KindPage, Record{Title: "Acme"}, "Acme"}, |
| 13 | {KindDaily, Record{Date: "2026-11-12", Body: "x"}, "2026-11-12\n\nx"}, |
| 14 | {KindScratch, Record{Body: "Only [[Acme]]."}, "Only [[Acme]]."}, |
| 15 | } { |
| 16 | if got := check.record.S3(check.kind); got != check.want { |
| 17 | t.Errorf("%s: %q, want %q", check.kind, got, check.want) |
| 18 | } |
| 19 | } |
| 20 | } |
| 21 | |