Code cleanup

This commit is contained in:
Noah Campbell 2013-10-01 19:59:35 -07:00
parent 19cb6c7819
commit 689cda1740
4 changed files with 10 additions and 11 deletions

View file

@ -1,8 +1,8 @@
package target
import (
"io"
"bytes"
"io"
)
type InMemoryTarget struct {
@ -22,4 +22,3 @@ func (t *InMemoryTarget) Publish(label string, reader io.Reader) (err error) {
func (t *InMemoryTarget) Translate(label string) (dest string, err error) {
return label, nil
}

View file

@ -1,8 +1,8 @@
package transform
import (
"io"
"bytes"
"io"
)
type chain struct {
@ -23,7 +23,7 @@ func (c *chain) Apply(w io.Writer, r io.Reader) (err error) {
}
in = bytes.NewBuffer(out.Bytes())
}
_, err = io.Copy(w, in)
return
}

View file

@ -23,7 +23,7 @@ const H5_JS_CONTENT_ABS_URL_WITH_NAV = "<!DOCTYPE html><html><head><script src=\
const CORRECT_OUTPUT_SRC_HREF_WITH_NAV = "<!DOCTYPE html><html><head><script src=\"http://two/foobar.js\"></script></head><body><nav><ul><li hugo-nav=\"section_0\"></li><li hugo-nav=\"section_1\" class=\"active\"></li></ul></nav><article>content <a href=\"http://two/foobar\">foobar</a>. Follow up</article></body></html>"
var two_chain_tests = []test {
var two_chain_tests = []test{
{H5_JS_CONTENT_ABS_URL_WITH_NAV, CORRECT_OUTPUT_SRC_HREF_WITH_NAV},
}

View file

@ -25,15 +25,15 @@ func TestAbsUrlify(t *testing.T) {
}
type test struct {
content string
content string
expected string
}
var abs_url_tests = []test {
{H5_JS_CONTENT_DOUBLE_QUOTE, CORRECT_OUTPUT_SRC_HREF},
{H5_JS_CONTENT_SINGLE_QUOTE, CORRECT_OUTPUT_SRC_HREF},
{H5_JS_CONTENT_ABS_URL, H5_JS_CONTENT_ABS_URL},
}
var abs_url_tests = []test{
{H5_JS_CONTENT_DOUBLE_QUOTE, CORRECT_OUTPUT_SRC_HREF},
{H5_JS_CONTENT_SINGLE_QUOTE, CORRECT_OUTPUT_SRC_HREF},
{H5_JS_CONTENT_ABS_URL, H5_JS_CONTENT_ABS_URL},
}
func apply(t *testing.T, tr Transformer, tests []test) {
for _, test := range tests {