Refactor writer tests

Until now we're not using t.Run to create a sub test for each fixture - for the
current bug I want to only run a single file as I'm a print debugger and don't
care for the noise of logs from other tests. While at it, it made sense to
merge the implementations.
This commit is contained in:
Niklas Fasching 2022-06-18 15:06:48 +02:00
parent 10b71b143a
commit 0f145082ad
2 changed files with 20 additions and 30 deletions

View file

@ -16,20 +16,7 @@ func (w *ExtendedHTMLWriter) WriteText(t Text) {
}
func TestHTMLWriter(t *testing.T) {
for _, path := range orgTestFiles() {
expected := fileString(path[:len(path)-len(".org")] + ".html")
reader, writer := strings.NewReader(fileString(path)), NewHTMLWriter()
actual, err := New().Silent().Parse(reader, path).Write(writer)
if err != nil {
t.Errorf("%s\n got error: %s", path, err)
continue
}
if actual != expected {
t.Errorf("%s:\n%s'", path, diff(actual, expected))
} else {
t.Logf("%s: passed!", path)
}
}
testWriter(t, func() Writer { return NewHTMLWriter() }, ".html")
}
func TestExtendedHTMLWriter(t *testing.T) {