source: Normalize UniqueID between Windows & Linux

This commit is contained in:
Matthieu Harlé 2017-08-09 15:42:50 +02:00 committed by Bjørn Erik Pedersen
parent e2f8664ef4
commit 0abdeeef67
2 changed files with 6 additions and 1 deletions

View file

@ -155,7 +155,7 @@ func (sp SourceSpec) NewFile(relpath string) *File {
}
f.section = helpers.GuessSection(f.Dir())
f.uniqueID = helpers.Md5String(f.Path())
f.uniqueID = helpers.Md5String(filepath.ToSlash(f.relpath))
return f
}

View file

@ -37,6 +37,11 @@ func TestFileUniqueID(t *testing.T) {
f4 := ss.NewFile(filepath.FromSlash("test2/index.md"))
assert.NotEqual(t, f3.UniqueID(), f4.UniqueID())
f5l := ss.NewFile("test3/index.md")
f5w := ss.NewFile(filepath.FromSlash("test3/index.md"))
assert.Equal(t, f5l.UniqueID(), f5w.UniqueID())
}
func TestFileString(t *testing.T) {