summaryrefslogtreecommitdiffstats
path: root/resource/testhelpers_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-03-14 09:33:32 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-03-14 17:04:14 +0100
commit3fbc75534d1acda2be1c597aa77c919d3a02659d (patch)
treeaf0388879ab8053b21fe41fdf8e8a869033981b3 /resource/testhelpers_test.go
parente427ba4268603de7b096f48e7dbda40e03750911 (diff)
resource: Fix path duplication/flattening in processed images
Fixes #4502 Closes #4501
Diffstat (limited to 'resource/testhelpers_test.go')
-rw-r--r--resource/testhelpers_test.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/resource/testhelpers_test.go b/resource/testhelpers_test.go
index 89653ce11..a9015ab2c 100644
--- a/resource/testhelpers_test.go
+++ b/resource/testhelpers_test.go
@@ -94,7 +94,7 @@ func fetchImageForSpec(spec *Spec, assert *require.Assertions, name string) *Ima
}
func fetchResourceForSpec(spec *Spec, assert *require.Assertions, name string) Resource {
- src, err := os.Open("testdata/" + name)
+ src, err := os.Open(filepath.FromSlash("testdata/" + name))
assert.NoError(err)
workingDir := spec.Cfg.GetString("workingDir")
@@ -116,8 +116,9 @@ func fetchResourceForSpec(spec *Spec, assert *require.Assertions, name string) R
return r
}
-func assertFileCache(assert *require.Assertions, fs *hugofs.Fs, filename string, width, height int) {
- f, err := fs.Source.Open(filepath.Join("/res/_gen/images", filename))
+
+func assertImageFile(assert *require.Assertions, fs *hugofs.Fs, filename string, width, height int) {
+ f, err := fs.Source.Open(filename)
assert.NoError(err)
defer f.Close()
@@ -128,6 +129,10 @@ func assertFileCache(assert *require.Assertions, fs *hugofs.Fs, filename string,
assert.Equal(height, config.Height)
}
+func assertFileCache(assert *require.Assertions, fs *hugofs.Fs, filename string, width, height int) {
+ assertImageFile(assert, fs, filepath.Join("/res/_gen/images", filename), width, height)
+}
+
func writeSource(t testing.TB, fs *hugofs.Fs, filename, content string) {
writeToFs(t, fs.Source, filename, content)
}