diff options
Diffstat (limited to 'modules/caddyhttp/templates/tplcontext_test.go')
-rw-r--r-- | modules/caddyhttp/templates/tplcontext_test.go | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/modules/caddyhttp/templates/tplcontext_test.go b/modules/caddyhttp/templates/tplcontext_test.go index d9aab0caa..37b63822d 100644 --- a/modules/caddyhttp/templates/tplcontext_test.go +++ b/modules/caddyhttp/templates/tplcontext_test.go @@ -31,6 +31,7 @@ package templates import ( "bytes" "fmt" + "html/template" "io/ioutil" "net/http" "os" @@ -47,17 +48,20 @@ func TestMarkdown(t *testing.T) { for i, test := range []struct { body string - expect string + expect template.HTML }{ { body: "- str1\n- str2\n", expect: "<ul>\n<li>str1</li>\n<li>str2</li>\n</ul>\n", }, } { - result := string(context.Markdown(test.body)) + result, err := context.funcMarkdown(test.body) if result != test.expect { t.Errorf("Test %d: expected '%s' but got '%s'", i, test.expect, result) } + if err != nil { + t.Errorf("Test %d: got error: %v", i, result) + } } } @@ -180,7 +184,7 @@ func TestStripHTML(t *testing.T) { expect: `<h1hi`, }, } { - actual := context.StripHTML(test.input) + actual := context.funcStripHTML(test.input) if actual != test.expect { t.Errorf("Test %d: Expected %s, found %s. Input was StripHTML(%s)", i, test.expect, actual, test.input) } @@ -249,7 +253,7 @@ func TestFileListing(t *testing.T) { // perform test input := filepath.ToSlash(filepath.Join(filepath.Base(dirPath), test.inputBase)) - actual, err := context.ListFiles(input) + actual, err := context.funcListFiles(input) if err != nil { if !test.shouldErr { t.Errorf("Test %d: Expected no error, got: '%s'", i, err) |