gowiki/pkg/render/render_test.go
2021-02-18 22:52:28 +01:00

35 lines
731 B
Go

// Copyright (C) 2021 Marius Schellenberger
package render
import (
"testing"
)
func TestTitleFunctions(t *testing.T) {
section := "section"
title := "title"
combined := "section/title"
t.Run("StoreTitle", func(t *testing.T) {
if StoreTitle(section, title) != combined {
t.Fail()
}
})
t.Run("SplitStoreTitle", func(t *testing.T) {
se, ti := SplitStoreTitle(combined)
if se != section || ti != title {
t.Fail()
}
})
t.Run("SplitStoreTitleSingle", func(t *testing.T) {
se, ti := SplitStoreTitle(section)
if se != section || ti != "" {
t.Fail()
}
})
t.Run("Title", func(t *testing.T) {
if Title("9ßw$%4h4t-8v74 287(G /SV&3[45v}=94#+?)") != "9w4h4t-8v74+287G+SV345v94" {
t.Fail()
}
})
}