From f3d3b16108e202f022868177ef1c9f8b67432037 Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Sat, 18 Apr 2020 22:24:38 +0200 Subject: Tests for `buildFeeds` and corresponding fixes --- internal/config/config.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'internal/config/config.go') diff --git a/internal/config/config.go b/internal/config/config.go index 361246e..e330a48 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -3,11 +3,37 @@ package config import ( "fmt" "io/ioutil" + "strings" ) type Map map[string]interface{} type Feeds map[string]*Feed +func (f Feeds) String() string { + var b strings.Builder + app := func(a ...interface{}) { + _, _ = fmt.Fprint(&b, a...) + } + app("Feeds [") + + first := true + for k, v := range f { + if !first { + app(", ") + } + app(`"`, k, `"`, ": ") + if v == nil { + app("") + } else { + _, _ = fmt.Fprintf(&b, "%+v", *v) + } + first = false + } + app("]") + + return b.String() +} + type Config struct { GlobalConfig Map Feeds Feeds -- cgit v1.2.3-54-g00ecf