output: Rework the base template logic

Extract the logic to a testable function and add support for custom output types.

Fixes #2995
This commit is contained in:
Bjørn Erik Pedersen
2017-03-19 21:09:31 +01:00
parent c7c6b47ba8
commit baa29f6534
8 changed files with 394 additions and 91 deletions

View File

@@ -34,10 +34,10 @@ func TestDefaultTypes(t *testing.T) {
}
func TestGetType(t *testing.T) {
tp, _ := GetType("html")
tp, _ := GetFormat("html")
require.Equal(t, HTMLType, tp)
tp, _ = GetType("HTML")
tp, _ = GetFormat("HTML")
require.Equal(t, HTMLType, tp)
_, found := GetType("FOO")
_, found := GetFormat("FOO")
require.False(t, found)
}