go-org-orgwiki/org/html_test.go
Niklas Fasching 7a8e90f786 Improve logging and error handling
- enable logging by default: debug was a bad name - it's error logging that I
  just want to hide in tests
- don't panic (all the time)
- use a logger. this allows us to add more information - like the path of the
  parsed file!
2018-12-19 20:25:16 +01:00

23 lines
552 B
Go

package org
import (
"strings"
"testing"
)
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 := NewDocument().Silent().SetPath(path).Parse(reader).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)
}
}
}