diff options
author | spf13 <steve.francia@gmail.com> | 2014-10-16 20:20:09 -0400 |
---|---|---|
committer | spf13 <steve.francia@gmail.com> | 2014-10-16 20:20:09 -0400 |
commit | 5dfc1dedb8ac53b7a2d3823d06808ae86f90b3d9 (patch) | |
tree | e90f9cfbcc920685dd9bceecd1925abec81ae0c0 /source/filesystem_test.go | |
parent | 24bbfe7d32fe151487ff87394433622e3f69eee4 (diff) | |
download | hugo-5dfc1dedb8ac53b7a2d3823d06808ae86f90b3d9.tar.gz hugo-5dfc1dedb8ac53b7a2d3823d06808ae86f90b3d9.zip |
Big refactor of how source files are used. Also added default destination extension option.
Diffstat (limited to 'source/filesystem_test.go')
-rw-r--r-- | source/filesystem_test.go | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/source/filesystem_test.go b/source/filesystem_test.go index b885d2f24..d2639310e 100644 --- a/source/filesystem_test.go +++ b/source/filesystem_test.go @@ -32,16 +32,17 @@ func TestAddFile(t *testing.T) { } for _, src := range []*Filesystem{srcDefault, srcWithBase} { + p := test.filename if !filepath.IsAbs(test.filename) { p = path.Join(src.Base, test.filename) } if err := src.add(p, bytes.NewReader([]byte(test.content))); err != nil { - if err == errMissingBaseDir { + if err.Error() == "source: missing base directory" { continue } - t.Fatalf("%s add returned and error: %s", p, err) + t.Fatalf("%s add returned an error: %s", p, err) } if len(src.Files()) != 1 { @@ -49,8 +50,8 @@ func TestAddFile(t *testing.T) { } f := src.Files()[0] - if f.LogicalName != test.logical { - t.Errorf("Filename (Base: %q) expected: %q, got: %q", src.Base, test.logical, f.LogicalName) + if f.LogicalName() != test.logical { + t.Errorf("Filename (Base: %q) expected: %q, got: %q", src.Base, test.logical, f.LogicalName()) } b := new(bytes.Buffer) @@ -59,12 +60,12 @@ func TestAddFile(t *testing.T) { t.Errorf("File (Base: %q) contents should be %q, got: %q", src.Base, test.content, b.String()) } - if f.Section != test.section { - t.Errorf("File section (Base: %q) expected: %q, got: %q", src.Base, test.section, f.Section) + if f.Section() != test.section { + t.Errorf("File section (Base: %q) expected: %q, got: %q", src.Base, test.section, f.Section()) } - if f.Dir != test.dir { - t.Errorf("Dir path (Base: %q) expected: %q, got: %q", src.Base, test.dir, f.Dir) + if f.Dir() != test.dir { + t.Errorf("Dir path (Base: %q) expected: %q, got: %q", src.Base, test.dir, f.Dir()) } } } |