Skip to content

Commit

Permalink
Add basic test setup for editor module
Browse files Browse the repository at this point in the history
  • Loading branch information
slawekkolodziej committed Apr 15, 2016
1 parent e8bee56 commit 28dae06
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion editor/editor.go
Expand Up @@ -63,4 +63,4 @@ func processHtml(markdown string, doc *template.Template) string {

// Return formatted HTML
return buf.String()
}
}
17 changes: 17 additions & 0 deletions editor/editor_test.go
@@ -0,0 +1,17 @@
package editor

import (
"text/template"
"testing"
)

func TestBasicHtmlProcessing(t *testing.T) {
var html string
tmpl := template.Must(template.New("test").Parse("{{.Name}}:{{.Body}}"))
html = processHtml("foobar", tmpl)
expected := "test:foobar"

if html != expected {
t.Error("Expected", expected, "got", html)
}
}

0 comments on commit 28dae06

Please sign in to comment.