Skip to content

Commit

Permalink
source: Normalize UniqueID between Windows & Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
Shywim authored and bep committed Aug 9, 2017
1 parent e2f8664 commit 0abdeee
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion source/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
5 changes: 5 additions & 0 deletions source/file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 0abdeee

Please sign in to comment.