shitty-ssg/pkg/adoc/inline_test.go

51 lines
832 B
Go
Raw Normal View History

package adoc_test
import (
"testing"
2021-09-30 07:10:33 +02:00
"ewintr.nl/go-kit/test"
"ewintr.nl/shitty-ssg/pkg/adoc"
)
func TestInlineSimple(t *testing.T) {
text := "text"
for _, tc := range []struct {
name string
element adoc.InlineElement
}{
{
name: "plain text",
element: adoc.PlainText(text),
},
{
name: "strong",
element: adoc.StrongText(text),
},
{
name: "emphasis",
element: adoc.EmpText(text),
},
{
name: "strong emphasis",
element: adoc.StrongEmpText(text),
},
{
name: "code",
element: adoc.CodeText(text),
},
} {
t.Run(tc.name, func(t *testing.T) {
test.Equals(t, text, tc.element.Text())
})
}
}
func TextLink(t *testing.T) {
url := "url"
title := "title"
l := adoc.NewLink(url, title)
test.Equals(t, url, l.URL())
test.Equals(t, title, l.Text())
}